1 function rc = ran_cone(w)
4 f = @(x,y,x0,y0,m) m*sqrt((x-x0).^2+(y-y0).^2)+1.5*cos(4*sqrt((x-x0).^2+(y-y0).^2))-1;
6 [p,q] = size(w.fxlong);
7 tx = linspace(-10,10,p);
8 ty = linspace(-10,10,q);
9 [x,y] = meshgrid(tx,ty);
18 % m <= (z_max-z0)/(9-r)
19 %m = (1/2+rand)*(z_max-z0)/(radius-r);
20 m = (1+2*rand)*(z_max-z0)/(radius-r);
35 % z0 = 1/4*z_max*rand;
38 new_x0 = (new_x0+rand)*cos(theta);
39 new_y0 = (new_y0+rand)*sin(theta);
45 r = sqrt(new_x0^2+new_y0^2);
46 new_m =(1+4*rand)*(z_max-z0)/(radius+2*randn-r)+base+rand;
49 z2 = f(x,y,new_x0,new_y0,new_m);
51 % noise = 10/z_max*randn(p,q);
56 %figure,mesh(x,y,z),hold on,mesh(x,y,z2),hold off;
57 %z(z2>z0) = max(z(z2>z0),z2(z2>z0));
58 z(z2>z) = alpha*z(z2>z)+(1-alpha)*z2(z2>z);
59 %z = imgaussfilt(z,1/2);
63 %figure(234),contour(x,y,z,20,'k')
70 %figure,plot(c(:,1),c(:,2));
71 %figure,contour(x,y,z,20,'k');