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

8 visualizaciones (últimos 30 días)
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)?

Respuestas (1)

Palguna Gopireddy
Palguna Gopireddy el 28 de Dic. de 2022
Editada: Palguna Gopireddy el 28 de Dic. de 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