plot a fourier series representation of function

2 comentarios

sawee jdan
sawee jdan el 30 de Sept. de 2020
i tried this but i am not sure, i think there is a mistake
t = linspace( -pi/0.01 , pi/0.01 );
for i=[1:2:5]
y=(4/pi)*(sin(i*t)/i);
end
for j=[1:2:39]
g=(4/pi)*(sin(j*t)/j);
end
plot(y ,g)

Iniciar sesión para comentar.

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 30 de Sept. de 2020
Editada: Ameer Hamza el 30 de Sept. de 2020
Check this code
t = linspace( -pi , pi );
y1 = zeros(size(t));
for i = 1:2:5
y1 = y1 + (4/pi)*(sin(i*t)/i);
end
y2 = zeros(size(t));
for j= 1:2:39
y2 = y2 + (4/pi)*(sin(j*t)/j);
end
subplot(2,1,1)
plot(t, y1)
subplot(2,1,2)
plot(t, y2)

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 30 de Sept. de 2020

Editada:

el 30 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by