Plotting the Fourier Series

Hi,
I am trying to plot the x(t) and t should be between -3 to 3. I calculate the a_k and I used the code given below. However, I could not get the plot what I expect. Capital T should be equal to 2. What is wrong in these lines? Thank you very much.
f=0;
t=linspace(-3,3);
for k=-100:1:100
a_k= (((pi^2)*(k^2)*(1^2)-2*(pi^2)*(k^2)-2*(2^2).*sin((k*pi*1/2))+2*pi*k*2*1.*cos((k*pi*1/2)))/2*(pi^3)*(k^3));
f=f+a_k*(exp(j*2*pi*k*t/2)); % for T=2
end
figure;
plot(t,f);

1 comentario

Sharmin Kibria
Sharmin Kibria el 25 de Jun. de 2021
Hi,
Can you write down the mathematical expression you are using for calculating the values of a_k? It will easier for me check if it getting calculated correctly.
Thanks
Sharmin

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 24 de Jun. de 2021

Comentada:

el 25 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by