Search code examples
matlabimage-processingspiral

Add noise to dashed spiral plot


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','--');

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.