sampling

조회 수: 4 (최근 30일)
john
john 2011년 4월 4일
답변: Sreejith Thazhathe Veetil 2023년 2월 14일
Hello to everyone,
I want to draw a period of y=sin(x) function and take 10 samples with the same interval among them. Next, to each sample I want to add a random value of noise, which value must come from the Gaussian distribution N(0,1).Could someone help me?
Thanks in advance

채택된 답변

bym
bym 2011년 4월 4일
doc linspace
doc randn

추가 답변 (2개)

Prathamraj  Chauhan
Prathamraj Chauhan 2022년 1월 25일
Clc

Sreejith Thazhathe Veetil
Sreejith Thazhathe Veetil 2023년 2월 14일
See the following code. By selecting Fs and duration, you can obtain required number of samples.
T=10; % Duration of signal (sec)
f=1; % Frequencey of sine (Hz)
Fs=20; % sampling frequency
sigma=0.1; % std of noise
N=T*Fs; % Number of samples
n=0:N-1; % sample indeces
x=sin(2*pi*f*n/Fs); % samples of sine
noise=sigma*randn(1,N); % adding noise
y=x+noise;
plot(n/Fs,y,'-*r',n/Fs,x,'-g');
legend('noisy','original')
xlabel('Time in sec')

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by