To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
jbeckton
New to the neighborhood
jbeckton
3 Posts

Polar Coordinates

Hi, we did some simple excersizes with rectangular and polar coordinates and are now tasked with using matlab to do the calculations for us. This is my senior year in engineering and I haven't really used much Matlab since my freshmen year so it's a bit of a struggle. I have managed to get all of the other problem s in Matlab but am stuck with this last one. Any help would be greatly appreciated. Thanks in advance:

Perform the operation using polar coordinates, and express the result in standard rectangular form: (2+j)^2

I used the following function to convert 2+j to polar coordinates:



>> [Theta_a, R_a] = cart2pol( real(2), imag(j) )

Theta_a =

0.4636


R_a =

2.2361



So I now have the function is polar coordinates but I do not know how to square this function before converting ot back to rectangular coordinates uning this function:



[x, y] = pol2cart(Theta_a, R_a);
new_a = x + y*i



The answer should be: 5[cos(2theta) + j sin(2theta)], theta=tan^-1 (1/2)

Can anyone tell me what I need to do to square that function?

Thanks
shwaip
elaborate bot
shwaip
5,730 Posts
it's probably better to just write your own conversion, rather than use the matlab builtins. that way you can learn something.

for polar [ r e^(I theta) ] -> Cartesian (a+bI):
a=r*cos(theta);
b=r*sin(theta);

for cart -> polar:
r=sqrt((a.^2 + b.^2));
theta = atan2(b,a);
__________________ my photostream for ic photography challenge

Anyone who wants dropbox, please use my referral link
jbeckton
New to the neighborhood
jbeckton
3 Posts
Thanks, that will help me get from polar to cartesian, but how do I perform the requested operation using polar coordinates?

This is what I tried and I think it is correct, can you confirm?

>> [Theta_a, R_a] = cart2pol( real(2), imag(j) )
Theta_a =
0.4636

R_a =
2.2361
>> r=2.2361
r =
2.2361
>> theta=.4636
theta =
0.4636
>> (r*exp(theta*j))^2
ans =
3.0005 + 3.9998i
beatz
Icrontic Technician
beatz
77 Posts
Well, you could easily confirm it yourself by calcuting (2+j)^2.

(2+j)^2 = (2+j)(2+j) = (4+2j+2j-1) = (3+4j)

Rather large error in your result for my taste, however I don't know matlab that well.
__________________ ( unzip; strip; touch; finger; mount; gasp; yes; umount; sleep )
[folding_sig1]
jbeckton
New to the neighborhood
jbeckton
3 Posts
As you can see Matlab has rounded r and theta, I was asking if anyone knew how to remedy this or if it is acceptable.
shwaip
elaborate bot
shwaip
5,730 Posts
rather than re-assigning the values to r and theta by typing them out, you can do:

r = R_a;
theta=Theta_a;
Similar Threads
Thread Thread Starter Forum Replies Last Post
Photoshop Question: is it possible to see coordinates while drawing (x,y) ? Mizugori Web & Digital Media 1 19 Oct 2007 3:30pm
Ubuntu Updates are Changing My Partition Coordinates fatsheep Operating Systems 3 23 Sep 2006 6:59pm
Lakeview Polar Bear Club Presents 5th Annual Celebration of Shrinkage - starring Short-Media staff members primesuspect Technology Articles 27 18 Jan 2006 4:40pm

Go Back   Icrontic Forums > Tech: Software > General Software > Matlab Help
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 4:13pm (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.