Skip to content

Instantly share code, notes, and snippets.

@tausen
Created January 1, 2012 11:18
Show Gist options
  • Save tausen/1547052 to your computer and use it in GitHub Desktop.
Save tausen/1547052 to your computer and use it in GitHub Desktop.
MATLAB fourier series test
syms n t;
% Set d to the series, using symsum()
d=1+symsum(sin(n/2*t)*(sin(((n+2)*pi)/(2))*4/(pi^2*n^2)+(-1)^n*2/(n*pi)),n,1,100);
% Prep an x-axis
t=linspace(-10,10,1000);
% Evaluate the values accordingly
data=eval(d);
% And plot it
plot(t,data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment