Plotting The Amplitude for Fourier Series Coefficients

32 visualizaciones (últimos 30 días)
Salik Mallick
Salik Mallick el 1 de Oct. de 2020
Comentada: Ameer Hamza el 1 de Oct. de 2020
%% 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))

Respuestas (1)

Ameer Hamza
Ameer Hamza el 1 de Oct. de 2020
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 comentarios
Salik Mallick
Salik Mallick el 1 de Oct. de 2020
Thank you, but how do I plot the actual function?
Ameer Hamza
Ameer Hamza el 1 de Oct. de 2020
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)

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by