필터 지우기
필터 지우기

Plotting The Amplitude for Fourier Series Coefficients

조회 수: 3 (최근 30일)
Salik Mallick
Salik Mallick 2020년 10월 1일
댓글: Ameer Hamza 2020년 10월 1일
%% Problem 1
display('Problem 1')
syms n t
Wo = pi;
T = 2;
n = 1:10;
a0=(1/T)*(int(t,t,0,1))
an= (2/T)*(int(t*cos(n*Wo*t),0,1))
bn=(2/T)*(int(t*sin(n*Wo*t),0,1))

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 1일
Something like this
syms n t
Wo = pi;
T = 2;
n = 1:10;
a0 = (1/T)*int(t,t,0,1);
an = (2/T)*int(t*cos(n*Wo*t),0,1);
bn = (2/T)*int(t*sin(n*Wo*t),0,1);
subplot(2,1,1)
title('an');
stem(0:10, [a0 an])
subplot(2,1,2)
title('bn');
stem(1:10, bn)
  댓글 수: 2
Salik Mallick
Salik Mallick 2020년 10월 1일
Thank you, but how do I plot the actual function?
Ameer Hamza
Ameer Hamza 2020년 10월 1일
Following plot actual function
syms n t
Wo = pi;
T = 2;
n = 1:10;
a0 = (1/T)*int(t,t,0,1);
an = (2/T)*int(t*cos(n*Wo*t),0,1);
bn = (2/T)*int(t*sin(n*Wo*t),0,1);
t = linspace(0, 1);
x = zeros(size(t));
x(:) = a0;
for i = 1:numel(an)
x = x + an(i)*cos(Wo*i*t) + bn(i)*sin(Wo*i*t);
end
plot(t, x)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by