Cross product in 2d and 3D

조회 수: 7 (최근 30일)
Dhafer
Dhafer 2012년 12월 3일
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

답변 (2개)

Walter Roberson
Walter Roberson 2012년 12월 3일
[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
Walter Roberson
Walter Roberson 2012년 12월 4일
Do you mean like,
[theta, r] = cart2pol(x, y);
Dhafer
Dhafer 2013년 1월 9일
thanks

댓글을 달려면 로그인하십시오.


Dhafer
Dhafer 2013년 1월 9일
how can create loop in mat lab in east way?
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 1월 9일
Usually a "for" loop is the easiest.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by