Hello,(adsbygoogle = window.adsbygoogle || []).push({});

I've written a piece of code in MATLAB,to depict the function x(t)

I have the Fourier coefficients of this function as following:

a(k) = 1/(k.*pi)^2

where k is even andotherwise a(k) = 0.

also we know thatx(t+5) = x(t)

my code is :problem is, when MATLAB plots the function, it appears to have aCode (Text):

function [zaribX] = Ak(k)

if ~((mod(k,2) == 1) || k==0)

zaribX=1./(k.*pi).^2;

else zaribX=0;

end

return;

end

function [x] = FunctionX(Kmax,t)

x = 0;

for m = 0:Kmax

f = 2 .* abs(Ak(m)) .* cos( m .* ((2.*pi)./5) .* t + angle(Ak(m)));

x = x+f;

end

return;

end

period of 2.5, and not5. Could anyone help me see what's going wrong? Thanks a lot.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB plotting error?

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - MATLAB plotting error | Date |
---|---|

Matlab Plotting Coordinate Transformations in Matlab | Feb 12, 2018 |

Matlab Plotting animations (time-evolution) | Jan 17, 2018 |

Does anyone had this plotting problem with MATLAB? | Dec 23, 2017 |

Matlab Matlab's plot command | Nov 30, 2017 |

Matlab Matlab -- how to make a smooth contour plot? | Jun 28, 2017 |

**Physics Forums - The Fusion of Science and Community**