Sine wave oscilating around sine wave

1 回表示 (過去 30 日間)
Artur Gowel
Artur Gowel 2020 年 6 月 5 日
コメント済み: Artur Gowel 2020 年 6 月 5 日
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.

採用された回答

Shubhankar Poundrik
Shubhankar Poundrik 2020 年 6 月 5 日
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 件のコメント
Artur Gowel
Artur Gowel 2020 年 6 月 5 日
Yes, that's what I needed. Than You Sir!

サインインしてコメントする。

その他の回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 6 月 5 日
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 件のコメント
Artur Gowel
Artur Gowel 2020 年 6 月 5 日
Thank you for help!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by