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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!