plot - I am trying to draw a stream function in matlab -


i using code snap draw stream function

[x,y]= meshgrid(linspace(0,80),linspace(-8,8)); [t]=meshgrid(linspace(0,100)); b=1+0.3*cos(0.9*t); k=2*phi/10; low=.1+k.^2.*b.^2.*sin(k.*(x-0.9.*t)).^2; psi=-tanh((y-b.*cos(k.*(x-0.9.*t)))./sqrt(low)); contour(x,y,psi,3); colormap cool 

i wanted picture. getting current(the sin shape lines) not vortex(the rectangular shape). enter image description here enter image description here

i tried generate plot using parameters shown, but did not manage "vortex" shapes in contour plot. here implementation:

len = 200; [x,y] = meshgrid(linspace(0,80,len), linspace(-8,8,len)); t = meshgrid(linspace(0,1,len));  = 1.2; c = 0.12; k = 2*pi/7.5; w = 0.4; e = 0.3;  b = + e * cos(w*t); d = k * (x - c*t); psi = - tanh((y - b.*sin(d)) ./ sqrt(1 + (k * b.*cos(d)).^2)) + c*y;  figure('position',[100 100 650 300]) movegui('center')  subplot(211) contour(x, y, psi, 10), ylim([-4.5 4.5]) %colormap cool xlabel('kilometers'), ylabel('km'), title('mobility model')  subplot(212), axis off text(0.5, 0.5, ...     {['$\psi(x,y,t) = -\tanh{[ \frac{y - b(t) \sin(k(x-ct))}' ...     '{\sqrt{1 + k^2 b^2(t) \cos^2(k(x-ct))}} ]} + cy$'];     '$where\, b(t) = + \epsilon cos(\omega t)$'}, 'interpreter','latex', ...     'fontsize',20, 'horizontal','center', 'vertical','middle') 

matlab_contour_plot


leads me believe screenshot you've shown not match equation/parameters below it...

in fact if @ surface plot in 3d, you'll find there no shape in curve triangles in between sinusoidals. it's 2 almost-flat planes, dented drop in between.

here two-dimensional function shown surface plot:

surf(x, y, psi, 'facecolor','interp', 'edgecolor','none') daspect([20 6 1]) axis vis3d, axis tight box on, grid on, view(140,30) xlabel x, ylabel y, zlabel psi lighting phong camlight left 

surface_3d


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -