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)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by