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 Exchange에서 Fourier 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