Adding noise to a sine wave | MATLAB
close all,
clc,
t=0:0.01:2*pi;
x=sin(t);
y=rand(1,length(t));
x=x+y;
plot(t,x)
Please follow us:
https://www.facebook.com/matlabcodes
Join us on Telegram:
https://t.me/matlabirawen
Join us on Facebook Group:
https://www.facebook.com/groups/matlabcodes
The usual mistake with adding noise in MATLAB isn't the noise itself, it's the scaling — if the noise vector isn't normalised against the signal amplitude, the SNR changes silently and the plot looks fine while the numbers are wrong. Worth printing the ratio before plotting. I saw a similar point at vegashero and it applied here.
ReplyDelete