Fourier Transform

hey guys i am kinda new to matlab, and would really appreciate it if you guys help me thanx so much
Generate the following function
y1(t)=2*sin(2*pi*1*t)+4*sin(2*pi*2*t)+3*sin(2*pi*4*t)
y2(t)=2*cos(2*pi*1*t)+4*cos(2*pi*2*t)+3*cos(2*pi*4*t)
First, required by sampling theorem, the step size of t (delta t) has to be smaller than a value. Figure out this value and set the delta t at least 3 times smaller than this value and calculated y1(t) and y2(t). Increase the step size and recalculate y1(t) and y2(t). See the difference.
Calculate Fourier Transform of y1(t) and y2(t) using ‘fft’ and plot your results. Using frequency as the x axis data and amplitude as the y axis data. Also, plot the phase, too.
f=[0:1/length(y1):1/2]*(1/delta_t)
figure; plot(f, abs(y1(1:length(f))), -*)
Use function of ‘abs’ to calculate the amplitude and ‘angle’ to calculate phase.

3 件のコメント

Paulo Silva
Paulo Silva 2011 年 2 月 21 日
doc fft
zaini
zaini 2011 年 2 月 21 日
please use code writing mode, to make it more readable
khalid
khalid 2011 年 2 月 21 日
y1(t)=2*sin(2*pi*1*t)+4*sin(2*pi*2*t)+3*sin(2*pi*4*t)
y2(t)=2*cos(2*pi*1*t)+4*cos(2*pi*2*t)+3*cos(2*pi*4*t)
does this make it better?

サインインしてコメントする。

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 5 月 16 日

0 投票

delta_t=0.001; % Sampling time
fs=1/delta_t; % Sampling frequency
t = 0:delta_t:pi;% Time space
N = 2048; % Block size
y1=2*sin(2*pi*1*t)+4*sin(2*pi*2*t)+3*sin(2*pi*4*t);
y2=2*cos(2*pi*1*t)+4*cos(2*pi*2*t)+3*cos(2*pi*4*t);
Y1 = abs(fft(y1, N));
Y2 = abs(fft(y2, N));
f=(0:length(Y1)-1)*fs/length(Y1);
plot(f, Y1, 'r-', f, Y2, 'b'), grid on, legend('Y1', 'Y2', 'location', 'SouthEast')
title 'FFT of y_1(t) and y_2(t)'
xlim([0, 10])
shg
Yazan Almasri
Yazan Almasri 2022 年 1 月 16 日

0 投票

x(t)=2*sin(2*pi*t)

カテゴリ

ヘルプ センター および File ExchangeFourier Analysis and Filtering についてさらに検索

質問済み:

2011 年 2 月 21 日

回答済み:

2022 年 1 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by