Effacer les filtres
Effacer les filtres

Cross product in 2d and 3D

1 vue (au cours des 30 derniers jours)
Dhafer
Dhafer le 3 Déc 2012
Hi
I would like to combine the distance of r and the theta in one image.
Also, I would like to do the same in 3D.
please help in easy way because I am beginner.
[x y] = meshgrid(-10:1:10,-10:1:10,-10:1:10);
r=sqrt(x.^2+y.^2);
theta=(180/pi)*atan(y./x);
figure
surf(x,y,r)
figure
surf(x,y,theta)
Regards
Dhafer

Réponses (2)

Walter Roberson
Walter Roberson le 3 Déc 2012
[x y] = meshgrid(-10:1:10,-10:1:10,-10:1:10);
r=sqrt(x.^2+y.^2);
theta=(180/pi)*atan(y./x);
surf(x,y,r)
hold on
surf(x,y,theta)
hold off
would put them in the same axes.
If you want them in two different axes, then
[x y] = meshgrid(-10:1:10,-10:1:10,-10:1:10);
r=sqrt(x.^2+y.^2);
theta=(180/pi)*atan(y./x);
subplot(2,1,1)
surf(x,y,r)
subplot(2,1,2)
surf(x,y,theta)
  3 commentaires
Walter Roberson
Walter Roberson le 4 Déc 2012
Do you mean like,
[theta, r] = cart2pol(x, y);
Dhafer
Dhafer le 9 Jan 2013
thanks

Connectez-vous pour commenter.


Dhafer
Dhafer le 9 Jan 2013
how can create loop in mat lab in east way?
  1 commentaire
Walter Roberson
Walter Roberson le 9 Jan 2013
Usually a "for" loop is the easiest.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by