Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have been trying to plot fourier series but the plot is allways empty. I guess there is something wrong in my code but i dont know exactly what is it.

Looking here for some previous questions/answers I plotted the function in a lot of different ways but none of them worked.

Can someone help me with this :) ?

enter image description here

fx[n_, t_] := !( *UnderoverscriptBox[([Sum]), (i = (-n)), (n)](((Exp[ I*(((-1)*ima))*[Pi]]*((I*1 + ima*[Pi])) - 1))* Exp[I*ima*[Pi]*t]))

psums = Table[fx[n, t], {n, 1, 10}];

Plot[Evaluate[psums], {t, -4, 4}]

share|improve this question

closed as off-topic by Sjoerd C. de Vries, m_goldberg, Yves Klett, rasher, Michael E2 Apr 27 at 23:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Sjoerd C. de Vries, m_goldberg, Yves Klett, rasher, Michael E2
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Please provide your code as text rather than an image. It discourages people from helping you if you force them to retype something that you could easily have provided in the question. –  Oleksandr R. Apr 27 at 18:29
    
Thanks for the reply, I added the code bellow. –  Emiliano Apr 27 at 18:38
    
To view the real part or the imaginary part you can use: psums = Table[Re@fx[n, t], {n, 1, 10}]; or psums = Table[Im@fx[n, t], {n, 1, 10}]; –  Kardashev3 Apr 27 at 18:40
    
The result is imaginary, your code is fine. –  Gregory Rut Apr 27 at 18:40
    
Thanks for the replys, i had an error on the series expansion. ![enter image description here][1] [1]:i.imgur.com/xWakSVH.png –  Emiliano Apr 27 at 18:46

1 Answer 1

up vote 0 down vote accepted

To view the real part you can use:

psums1 = Table[Re@fx[n, t], {n, 1, 10}];
Plot[Evaluate[psums1], {t, -4, 4}, PlotRange -> All]

Mathematica graphics

and to view the imaginary part you can use:

psums2 = Table[Im@fx[n, t], {n, 1, 10}];
Plot[Evaluate[psums2], {t, -4, 4}, PlotRange -> All]

Mathematica graphics

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.