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:
<DL class=codebox><DT><DD><CODE>>> [Theta_a, R_a] = cart2pol( real(2), imag(j) )
Theta_a =
0.4636
R_a =
2.2361</CODE>
</DD></DL>
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:
<DL class=codebox><DT><DD><CODE>[x, y] = pol2cart(Theta_a, R_a);
new_a = x + y*i </CODE>
</DD></DL>
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
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:
<DL class=codebox><DT><DD><CODE>>> [Theta_a, R_a] = cart2pol( real(2), imag(j) )
Theta_a =
0.4636
R_a =
2.2361</CODE>
</DD></DL>
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:
<DL class=codebox><DT><DD><CODE>[x, y] = pol2cart(Theta_a, R_a);
new_a = x + y*i </CODE>
</DD></DL>
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
0
Comments
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);
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
(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.
r = R_a;
theta=Theta_a;