how can i add noise in particular place of the sine wave?

조회 수: 2 (최근 30일)
suganya saravanan
suganya saravanan 2015년 3월 6일
편집: Zikobrelli 2015년 3월 6일
i want to add noise in the middle of the sine wave. but if i use the rand() function it adds noise to the total signal.how to add noise in some parts of the signal only.kindly help me.......

채택된 답변

Rick Rosson
Rick Rosson 2015년 3월 6일
편집: Rick Rosson 2015년 3월 6일
noise = [ zeros(N,1) ; rand(M,1) ];
distorted = source + noise;
  댓글 수: 2
suganya saravanan
suganya saravanan 2015년 3월 6일
thank you for your answer. but it shows me error.its saying matrix dimension must agree. i attached you my coding along this. kindly help me in getting output.
if true
% clc;
clear all;
close all;
noiseAmplitude=2;
t=[0:0.1:10];
freq=1500;
samplefreq=2500;
source= sin(2*pi*(freq/samplefreq)*t);
figure(1);
plot(source);
grid on;
hold on;
noise = [ zeros(N,1) ; rand(M,1) ];
distorted = source + noise;
figure(2);
plot(distorted);code
end
if i add rand() then noise is added to full signal. i need in particular places only. kindly help me.
Zikobrelli
Zikobrelli 2015년 3월 6일
편집: Zikobrelli 2015년 3월 6일
you need to specify the values of M and N. For example, if you want to add noise to the first 10 points of your signal you can use,
N=10
M=numel(t)
changing the values of M and N will enable you to choose the signal indexes where the noise is applied

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation, Manipulation, and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by