Sine wave oscilating around sine wave

9 Ansichten (letzte 30 Tage)
Artur Gowel
Artur Gowel am 5 Jun. 2020
Kommentiert: Artur Gowel am 5 Jun. 2020
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.

Akzeptierte Antwort

Shubhankar Poundrik
Shubhankar Poundrik am 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.

Weitere Antworten (1)

Ameer Hamza
Ameer Hamza am 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)

Kategorien

Mehr zu Measurements and Feature Extraction finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by