rramya
Member level 4
Re: doubt regarding adding randn function to a sinusoidal si
I saw a code in mathworks.com which analyses the freq components of noisy time domain
signal by explicitly plotting power Vs freq
fs=1000; % sampling freq
T=1/fs; %sample time
L=1000; % signal length
t=(0:L-1)/T; %time vector
x=0.7*sin(2*pi*50*t)+sin(2*pi*120*t); % i/p signal i.e., two sinusoids were added
Now , we have noisy time domain signal
by corrupting the i/p signal x with zero mean random noise
MATLAB CODE:
noise_sig = original_sig + std_dev*randn(size(original_sig));
y=x+2*randn(size(t)); %sinusoids corrupted with zero mean random noise
here in the above line : why 2 has been inserted (which is the value of std deviation)
(I guess since two sinusoids has been involved & added )
instead it should be y=x+1*randn(size(t)); (so that var=std deviation=1)
can any one explain about the inclusion of 2.
Thank you
Added after 1 hours 47 minutes:
The answer for the above doubt is:
actually i was wondering why they fix the std deviation value as 2 (so high)
but then, as i proceed the code fully, in the amplitude Vs freq plot at two
specified freq (50Hz & 120 Hz the amplitude value is seen clearly high compared
to noise amplitude(close to original value)
as i varied the std deviation value to 1 ,In the plot i cant distinguish
between original signal and noise thats y they had fixed the std deviation as so high
I saw a code in mathworks.com which analyses the freq components of noisy time domain
signal by explicitly plotting power Vs freq
fs=1000; % sampling freq
T=1/fs; %sample time
L=1000; % signal length
t=(0:L-1)/T; %time vector
x=0.7*sin(2*pi*50*t)+sin(2*pi*120*t); % i/p signal i.e., two sinusoids were added
Now , we have noisy time domain signal
by corrupting the i/p signal x with zero mean random noise
MATLAB CODE:
noise_sig = original_sig + std_dev*randn(size(original_sig));
y=x+2*randn(size(t)); %sinusoids corrupted with zero mean random noise
here in the above line : why 2 has been inserted (which is the value of std deviation)
(I guess since two sinusoids has been involved & added )
instead it should be y=x+1*randn(size(t)); (so that var=std deviation=1)
can any one explain about the inclusion of 2.
Thank you
Added after 1 hours 47 minutes:
The answer for the above doubt is:
actually i was wondering why they fix the std deviation value as 2 (so high)
but then, as i proceed the code fully, in the amplitude Vs freq plot at two
specified freq (50Hz & 120 Hz the amplitude value is seen clearly high compared
to noise amplitude(close to original value)
as i varied the std deviation value to 1 ,In the plot i cant distinguish
between original signal and noise thats y they had fixed the std deviation as so high