Effacer les filtres
Effacer les filtres

Sine wave oscilating around sine wave

1 vue (au cours des 30 derniers jours)
Artur Gowel
Artur Gowel le 5 Juin 2020
Commenté : Artur Gowel le 5 Juin 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.

Réponse acceptée

Shubhankar Poundrik
Shubhankar Poundrik le 5 Juin 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.
  1 commentaire
Artur Gowel
Artur Gowel le 5 Juin 2020
Yes, that's what I needed. Than You Sir!

Connectez-vous pour commenter.

Plus de réponses (1)

Ameer Hamza
Ameer Hamza le 5 Juin 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)
  1 commentaire
Artur Gowel
Artur Gowel le 5 Juin 2020
Thank you for help!

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by