Skip to content

Instantly share code, notes, and snippets.

@caiorss
Forked from tausen/gist:1547052
Created December 25, 2016 21:21
Show Gist options
  • Save caiorss/160d8090d946d22a9878d93ed81846ae to your computer and use it in GitHub Desktop.
Save caiorss/160d8090d946d22a9878d93ed81846ae 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