i was trying to plot the streamlines on a disk so I creat a cirluar mesh grid as follows :
omega = [0:pi/50:pi]; R = [1:0.08:5];[ThetaG,RG] = meshgrid(omega,R);X = RG.*cos(ThetaG);Y = RG.*sin(ThetaG);
Then i define the gradiend of a potential function U,V .
and creat the starting points
theta=0:pi/48:2*pi; % THIS MEANS 48 GRADIENT LINES FROM EACH point
sx=0.01*cos(theta);sy=0.01*sin(theta); %STARTING POINTS FOR GRADIENT FLOW ARE EQUISPACED POINTS AT DISTACE 0.1 FROM EACH ZERO.
and try to plot the stream lines as follows:
figure; hold on;axis square on;for k=1:p h=streamline(X,Y,Dx,Dy,real(st(k))+sx,imag(st(k))+sy); set(h,'Color', rand(3,1),'Linewidth',0.01); plot(real(st(k)),imag(st(k)),'k*'); drawnow(); pause(0.1); set(gca, 'fontsize',10);end
but i get the error :
" Error using griddedInterpolant ,Interpolation requires at least two sample points in each dimension. " + ... "Error in interp1 (line 149) ," + ... "F = griddedInterpolant(X,V,method);" + ... "Error in stream2 (line 63) syi=interp1(yy(:),1:szu(1),sy(k)); " + ... "Error in streamline (line 62) ;" + ... "verts = stream2(x,y,u,v,sx,sy,options);
and i don't know why !!! if i take [X,Y]=meshgrid(-6:0.005:6); instead of the circular meshgrid i didn't get any error.
How can i resolve this problem and plot the streamline on a disk?
Best Answer