How to find the start and end coordinates of main-lobe of rectangular window spectrum.

15 visualizzazioni (ultimi 30 giorni)
The rectangular window spectrum is found like
M=66;
r=rectwin(M);
n=512;
r_fft=fft(r,n);
r_fft2=fftshift(r_fft);
r_fftdB=20*log10(abs(r_fft2));
figure
plot(1:n,r_fftdB)
title(M)
The spectrum of the rectanular window spectrum (r_fftdB) is given by r_fftdB.
The plotted spectrum is
The spectrum is symmetrical about the peak of main-lobe. The starting of main-lobe is at coordinate 249. The ending of the main-lobe is at 265, The peak of main-lobe is at 257.
How to find the values of staring and ending coordinates of main-lobe (249,265 respectively)?

Risposte (1)

Palguna Gopireddy
Palguna Gopireddy il 28 Dic 2022
Modificato: Palguna Gopireddy il 28 Dic 2022
I have tried this
M=66;
r=rectwin(M);
n=512;
r_fft=fft(r,n);
r_fft2=fftshift(r_fft);
r_fftdB=20*log10(abs(r_fft2));
[Max,I_max] = max(r_fftdB);
for i=I_max:-1:1
if r_fftdB(i)>r_fftdB(i-1)
start=i-1;
else
break;
end
end
for i=I_max:n
if r_fftdB(i)>r_fftdB(i+1)
ending=i+1;
else
break;
end
end
disp(start);
249
disp(ending);
265
Is there anyway we can get both the values in the same loop, so that the code-length and runtime minimizes?
Or
is there any other method to get these values?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by