Question

How can I add noise in this matlab spiral plot ??

 t = linspace(0,6*pi,1000);
 x = t.*cos(t);
 y = t.*sin(t);
 h = plot(x,y);
 set(h(1),'linewidth',20);
 set(h(1),'LineStyle','--');
Était-ce utile?

La solution

k = 0.2;
x = t.*cos(t) + k*(rand(size(t))-0.5);
y = t.*sin(t) + k*(rand(size(t))-0.5);

fiddle with k to adjust the amplitude of your noise.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top