how to find max freq and lamdha min for a pulse

조회 수: 1 (최근 30일)
kavya saxena
kavya saxena 2012년 5월 19일
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