how to find max freq and lamdha min for a pulse

2 次查看(过去 30 天)
hi all
i want to know how can i calculate max frequency and min wavelength for following function
y=15(1-cos(2 *pi*f*t/n)*sin(2*pi*f*t)
here f=0.5MHz
n=5cycle
the matlab coding which i did is
> f=0.5e6;
> fs=f*100;
> ts=1/fs;
> n=5
> t=0:ts:n/f;
> y=15*(1-cos(2*pi*f*t/n)).*cos(2*pi*f*t);
>plot (t,y)
>x=fft(y);
>plot(x);
now what should i do further......plz help me

采纳的回答

Wayne King
Wayne King 2012-5-19
ydft = fft(y);
ydft = ydft(1:floor(length(ydft)/2)+1);
[maxval,I] = max(abs(ydft));
freq = 0:fs/length(y):fs/2;
fprintf('Maximum at %2.3f Hz\n.', freq(I));
You would have been better with:
t=0:ts:n/f-ts;
y=15*(1-cos(2*pi*f*t/n)).*cos(2*pi*f*t);
ydft = fft(y);
ydft = ydft(1:length(ydft)/2+1);
[maxval,I] = max(abs(ydft));
freq = 0:fs/length(y):fs/2;
fprintf('Maximum at %2.3f Hz\n.', freq(I));
Due to the spacing of the frequencies in the DFT. As far as the wavelength, you have not told us the propagation speed, which you have to in order to determine wavelength. If we assume that it is the speed of light, then
lambda = 3e8/freq(I);
fprintf('Wavelength is %3.2f meters.\n',lambda)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by