How to change for loop to flip graph?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Cris LaPierre
am 13 Mär. 2019
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'
0 Kommentare
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!