How to draw a vector in 3D?

3 visualizaciones (últimos 30 días)
Nghia
Nghia el 25 de Mayo de 2014
Editada: Nghia el 25 de Mayo de 2014
Hello everyone, I'm doing a math project and there is a problem that I want to ask you. The project require to enter a coordinate of a point M. This point M belongs to the region limited by planes: z=4-y^2,z=0,x=0,x=1 and then draw the vector of this field in the position of M.
I try this code but it didn't work:
syms x y z
disp('Enter the coordinate of M');
x0=input('x0=');
y0=input('y0=');
z0=input('z0=');
g1=z+y^2-4;
g2=x-1;
g3=x;
g4=z;
if (z0~=4-y0^2) && (x0~=0) && (x0~=1) && (z0~=0)
disp('Nhap lai toa do M');
return
end
if (z0==4-y0^2)
quiver3(x0,y0,z0,double(subs(diff(g1,x),x0)), double(subs(diff(g1,y),y0)), double(subs(diff(g1,z),z0)));
else if (x0-1==0)
quiver3(x0,y0,z0,double(subs(diff(g2,x),x0)), double(subs(diff(g2,y),y0)), double(subs(diff(g2,z),z0)));
else if (x0==0)
quiver3(x0,y0,z0,double(subs(diff(g3,x),x0)), double(subs(diff(g3,y),y0)), double(subs(diff(g3,z),z0)));
else if (z0==0)
quiver3(x0,y0,z0,double(subs(diff(g4,x),x0)), double(subs(diff(g4,y),y0)), double(subs(diff(g4,z),z0)));
end
end
end
end
Please help me to fix it. Your help will be really appreciated. Thank you so much!

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by