5
我最近嘗試在我的流體問題集中繪製一些教程問題的velocicty字段。我寫了下面Matlab代碼Matlab代碼不會繪製函數的一部分
clear;
h_theta_multiple=0.01;
h_theta=h_theta_multiple*2*pi;
h_rho=0.1;
[theta,rho] = meshgrid(0:h_theta:2*pi,0:h_rho:5);
[x1,x2] = pol2cart(theta,rho);
N=[1 2 3 -1 -2 -3];
figure
for i=1:length(N)
n=N(i);
u1 = rho.^n .* cos(n.*theta);
u2 = rho.^n .* sin(n.*theta);
subplot(2,3,i);
quiver(x1,x2,u1,u2);
end
figure
for i=1:length(N)
n=N(i);
u1 = -rho.^n .* sin(n.*theta);
u2 = rho.^n .* cos(n.*theta);
subplot(2,3,i);
quiver(x1,x2,u1,u2);
end
第一和第二功能。我無法弄清楚爲什麼它不會爲n繪製陰性...我試圖隔離一切,但最終還是無法完全調試它。
有趣的是,該數據確實存在,但你不能看到它。 '顫抖(x1,x2,u1,u2,'o')'會顯示出來。 –
@AnderBiguri是的,我剛剛嘗試過,它的工作原理,但我確實想要矢量形式。這太奇怪了。 – thephysicsguy