Keeping getting gradient error and no figure 2
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function [] =ZacharyC1
clear all
clc
U=4.7;
m=6;
a=0.5;
[X,Y]=meshgrid (-2:0.05:-2,2:0.05:2);
r=sqrt(X.^2+Y.^2);
THETA=atan2(Y,X);
THETA1=atan2(Y,X+a);
THETA2=atan2(Y,X-a);
psi=U*r.*sin(THETA)+m*(THETA1-THETA2);
[DX,DY]=gradient(psi,.1,.1);
u=DY;
v=-DX;
contour (X,Y,psi,21);
hold on
quiver(X,Y,u,v,4)
hold off
[mm,nn]=size(u);
nnn=round(nn/3);
for i=1:mm
p(i,nnn)=0.5*U*U-0.5*(u(i,nnn)^2);
end
plot(p(:,nnn))
end
0 commentaires
Réponses (1)
VBBV
le 22 Avr 2024
%function [] =ZacharyC1
clear all
clc
U=4.7;
m=6;
a=0.5;
[X,Y]=meshgrid (linspace(-2,2,100),linspace(-2,2,100));
r=sqrt(X.^2+Y.^2);
THETA=atan2(Y,X);
THETA1=atan2(Y,X+a);
THETA2=atan2(Y,X-a);
psi=U*r.*sin(THETA)+m*(THETA1-THETA2)
[DX,DY]=gradient(psi,.1);
u=DY;
v=-DX;
contour (X,Y,psi,21);
hold on
quiver(X,Y,u,v,4)
hold off
[mm,nn]=size(u);
nnn=round(nn/3);
for i=1:mm
p(i,nnn)=0.5*U*U-0.5*(u(i,nnn)^2);
end
plot(p(:,nnn))
%end
2 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!