Skip to content

Instantly share code, notes, and snippets.

@MarcoPolo
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcoPolo/8797322 to your computer and use it in GitHub Desktop.
Save MarcoPolo/8797322 to your computer and use it in GitHub Desktop.
syms omega phi A t
v = A*cos(omega*t+phi);
v1 = subs(v, {A,omega,phi}, {100,120*pi,0});
tn = (0:0.01:1)/60;
subs(v1,t,tn)
%%
% *Part 4*
%
syms wt t ak k
N = 10;
T0 = 2;
ak = sin(k)/k;
wt = fouriersynth(ak, N, T0);
ezplot(wt, [-T0,T0])
axis tight
%% Higher values of N
N = 100;
wt = fouriersynth(ak, N, T0);
ezplot(wt, [-T0,T0])
%% Even Higher Values of N=1000
N = 1000;
wt = fouriersynth(ak, N, T0);
ezplot(wt, [-T0,T0])
%% 4.2
syms t xt XNt ak wwk k omega
T0 = 6;
xt = sin(2*pi*t/T0);
wwk = exp(-j*(2*pi*k/T0)*t)
ak = (1/T0)*int( xt*wwk, t, 0, T0/2)
ak = simple( ak )
N = 90;
xNt = fouriersynth( ak, N, T0);
ezplot(xNt, [-T0/2,2*T0]); grid on
%% Higher values of N
N = 90;
xNt = fouriersynth( ak, N, T0);
ezplot(xNt, [-T0/2,2*T0]); grid on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment