cartesian to polar?

조회 수: 12 (최근 30일)
katerina jablonski
katerina jablonski 2012년 6월 5일
i have tried to turn my values into polar (I need the angle of Ztot) but it's giving me the wrong value. where is my error?
C1Z = -1/(w*C1*1i);
C2Z = -1/(w*C2*1i);
LZ = w*L*1i;
Ztot = 1/((1/(C1R + C1Z)) + (1/(C2R + C2Z)) + (1/(LZ + Rw +Rsns)));
mag = abs(Ztot);
theta = (angle(Ztot));
real = mag;
imag = theta;
[th,r] = cart2pol (real,imag);
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2012년 6월 5일
don't overwrite the very useful builtin functions real() and imag()

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

답변 (3개)

Walter Roberson
Walter Roberson 2012년 6월 5일
You indicate that you need the angle of Ztot, but you seem to already be calculating that and placing it in theta. And then you are using that angle as if it was a cartesian coordinate ?? Your calculations look to me more like you have polar coordinates that you want to translate to cartesian ?

katerina jablonski
katerina jablonski 2012년 6월 5일
right, you can see that i'm not sure how to use these commands. we haven't been taught how to use matlab, so i'm trying to do this with no instruction. what is my best course to show the polar angle of Ztot? i don't know what to use or not use, and how to use it!
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 6월 5일
You can display values to the command window using disp() or fprintf(). You can display simple messages "pop-up" using msgdlg() and related functions. You can display text data in a user interface control area using uicontrol() or uitable(). You can display text data in a graphic drawing area using text(). You can plot lines in a graphic drawing area using plot() or line(). You can plot a polar coordinate graph in a graphic drawing area using polar()

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


katerina jablonski
katerina jablonski 2012년 6월 5일
okay here's what i ended up doing. it seems okay. any suggestions to make it better?
Ztot = ((1/(C1R + C1Z)) + (1/(C2R + C2Z)) + (1/(Rw + Rsns + LZ)))^(-1);
real = abs(Ztot)
imag = (angle(Ztot))*(180/pi)
theta = cosd(imag)
  댓글 수: 2
Honglei Chen
Honglei Chen 2012년 6월 5일
I don't quite get your question. You said you need the angle of Ztot, why isn't it just angle(Ztot)?
Walter Roberson
Walter Roberson 2012년 6월 5일
Ztot = ((1/(C1R + C1Z)) + (1/(C2R + C2Z)) + (1/(Rw + Rsns + LZ)))^(-1);
Zmag = abs(Ztot);
Zangle = angle(Ztot); %This is the angle in radians
Zdeg = Zangle * 180/pi; %and in degrees if you need that
Zcos = cos(Zangle); %cos of angle, not angle itself

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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by