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','--');
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top