Plotting the Fourier Series
Mostra commenti meno recenti
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 Commento
Sharmin Kibria
il 25 Giu 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
Risposte (0)
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!