Sine wave oscilating around sine wave

1 view (last 30 days)
Hi, I need help with generating specific sinusoidal signal. I want to generate clear sinusoidal signal. Then add "noise" of sinusoidal shape. However I want that noise sinusoid oscilate around line of clear sine wave. Picture to clearly show what i want to achieve:
I dont have ideas how coould I generate that noise sine wave.

Accepted Answer

Shubhankar Poundrik
Shubhankar Poundrik on 5 Jun 2020
Hi Artur,
I understand that you want to plot a sine wave and add another sine wave of smaller amplitude to it, so that it looks like noise.
The following code may be helpful:
t = 0:0.01:2; % time
n_t = length(t);
fs = 1; % frequency of signal
signal = sin(2.*pi.*fs.*t);
fn = 10; % frequency of noise
noise_Amplitude = 0.1;
sine_noise = noise_Amplitude.*sin(2.*pi.*fn.*t);
plot(t, signal+sine_noise)
If the requirement is to have the original signal and noisy signal in the same plot, the following code may be used:
t = 0:0.01:2; % time
n_t = length(t);
fs = 1; % frequency of signal
signal = sin(2.*pi.*fs.*t);
fn = 10; % frequency of noise
noise_Amplitude = 0.1;
sine_noise = noise_Amplitude.*sin(2.*pi.*fn.*t);
plot(t, signal, 'b')
hold on
plot(t, signal+sine_noise, 'r')
hold off
Regards,
Shubhankar.

More Answers (1)

Ameer Hamza
Ameer Hamza on 5 Jun 2020
Something like this?
t = linspace(0, 4*pi, 1000);
x1 = sin(t);
x2 = 0.1*sin(15*t);
y = x1+x2;
plot(t, y)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!