How to change for loop to flip graph?

2 ビュー (過去 30 日間)
T.A.S.
T.A.S. 2019 年 3 月 12 日
回答済み: Cris LaPierre 2019 年 3 月 13 日
How do i change my code to get my graph to flip so that the contour lines start at 0.05 and go down, also with the vector lines?
Vo=zeros(6,11);
V(1,:)=V(1,:)+100;
n=1;
k=0;
h = 0.01;
g = 0;
while k==0
Vo=V;
k=1;
for i=2:5
for j=2:10
V(i,j)=(Vo(i+1,j)+V(i-1,j)+V(i,j-1)+Vo(i,j+1)+ h^2*g)/4;
if abs((V(i,j)-Vo(i,j)))>(10^-5)
k=0;
end
end
end
n=n+1;
end
n;
x=0:0.01:0.1;
y=0:0.01:0.05;
[px,py] = gradient(V);
figure
contour (x,y,V)
hold on
quiver(x,y,px,py)
hold off

回答 (1 件)

Cris LaPierre
Cris LaPierre 2019 年 3 月 13 日
We don't have your variable V so I can't verify, but would adding this to the end of your code do it?
ax=gca;
ax.YDir = 'reverse'

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by