fs = 44100; % sampling rate T = 1/fs; % sampling period t = [0:T:0.1]; % time vector N = 6; % number of sinusoid components to sum f = 50; % fundamental frequency omega = 2*pi*f; % angular frequency phi = -2*pi*0.25; % 1/4 cycle phase offset x = 0; for n = 1:2:2*N, x = x + cos(n*omega*t + phi) ./ n; end plot(t, x); xlabel('Time (seconds)'); ylabel('xcomplex'); s = sprintf('Sum of %d Sinusoidal Components', N); title(s)
![]() | ©2004-2024 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |