MATLAB: Combine a waveform from a set of sine waves which are linearly increasing in frequency

frequencyplotsignal processing

Hi,
I generate and plot multiple waveforms which have increasing frequency. I want to combine them at each time interval of t, but how? Please share if you know how…
for f = 1:1:200 % Upto 200 Hz
t=[0 : 0.01 : 1]
y=sin (2 * pi .* f .* t);
hold on
plot (t,y)
end
thanks

Best Answer

Try this:
t = 0 : 0.01 : 1;
for f = 1:1:200 % Upto 200 Hz
y(f,:) = sin (2 * pi .* f .* t);
end
plot (t,y)
hold on
plot(t, sum(y), ':r', 'LineWidth',2.5)
hold off
The sum is essentially zero for all columns.