, which is given by:
fs = 44100; % sampling rate
T = 1/fs; % sampling period
t = 0:T:0.1; % time vector
N = 12; % 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:N
x = x + cos(n*omega*t + phi) ./ n;
end
plot(t, x);
xlabel('Time (seconds)');
ylabel('Signal Amplitude');
s = sprintf('Sum of %d Sinusoidal Components', N);
title(s)
fs = 44100; % sampling rate
N = 12; % number of sinusoid components to sum
M = 1024; % table size in samples
t = zeros(1, M);
for n = 1:N,
t = t + sin(2*pi*n*(0:M-1)/M) ./ n;
end
plot(t);
xlabel('Table Index (samples)');
ylabel('Signal Amplitude');
s = sprintf('Sum of %d Sinusoidal Components', N);
title(s)
| ©2004-2025 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |