Hi!
I was wondering if someone knows how to generate many sine waves at once (I also need to add them), for example, to generate 2 I use:
s_1 = (exp(j*2*pi*f_1*t) - exp(-j*2*pi*f_1*t))/(2*j);
s_2 = imag(exp(j*2*pi*f_2*t));
% plot the 2 and 4 Hz waves together in the same panel
figure
subplot(2,1,1)
plot(t,s_1, 'b-')
hold on
plot(t, s_2, 'r--')
ylabel('Amplitude')
% Plot the sum
subplot(2,1,2)
plot(t, s_1+s_2)
ylabel('Amplitude')
xlabel('Time (s)')
How can I do this without using Hold on.
Thank you
I was wondering if someone knows how to generate many sine waves at once (I also need to add them), for example, to generate 2 I use:
s_1 = (exp(j*2*pi*f_1*t) - exp(-j*2*pi*f_1*t))/(2*j);
s_2 = imag(exp(j*2*pi*f_2*t));
% plot the 2 and 4 Hz waves together in the same panel
figure
subplot(2,1,1)
plot(t,s_1, 'b-')
hold on
plot(t, s_2, 'r--')
ylabel('Amplitude')
% Plot the sum
subplot(2,1,2)
plot(t, s_1+s_2)
ylabel('Amplitude')
xlabel('Time (s)')
How can I do this without using Hold on.
Thank you