matlab - How to create a plot with the negative values of a noisy signal? -


so have generate cos fuction 0 2 pi added gaussian noise 0 mean , standard deviation of .5 have create different plots for:

a) signal noise , signal without noise

this i've done:

clear close % plot cos function 0 2 pi x = linspace(0, 2*pi, 1000); y1 = cos(x); noise =  .3*randn(1,1000); prob1a = y1 + noise; figure plot(x, y1, x, prob1a) 

b) plot negative values of noisy signal
c) plot positive values of noisy signal

i need parts b , c.

does want?

figure() pos_noise = noise; pos_noise(pos_noise < 0) = 0; plot(x, pos_noise) hold neg_noise = noise; neg_noise(neg_noise > 0) = 0; plot(x, neg_noise) 

enter image description here


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -