You are Here: Home >< Maths

# Complex Numbers - polar to cartesian form - matlab watch

1. How do i change the polar form of complex numbers to cartesian form?
2. (Original post by MatthewTG)
How do i change the polar form of complex numbers to cartesian form?
re^ixpi=r(cos(x)+isin(x))

x is your argument, r is modulus of z (magnitude of the line), sub in values and you'll have it in the form x+yi
3. (Original post by xyz9856)
re^ixpi=r(cos(x)+isin(x))

x is your argument, r is modulus of z (magnitude of the line), sub in values and you'll have it in the form x+yi
how do i do it in matlab?
4. Here is an example matlab function:

function [real,imaginary] = comp_polar_to_cart(r, theta)
% This function converts complex numbers from polar to cartesian coordinates.
% Input: r - modulus
% theta - complex angle (in rad)

% Output: real - real part
% imaginary - imaginary part

% error check
if numel(r) ~= numel(theta)
error('The input arguments must be of the same length!');
elseif numel(size(r) - size(theta)) ~= 0
error('The input arguments must be of the same dimension!');
end

% Cartesian coordinates:
real = r .* cos(theta);
imaginary = r .* sin(theta);
5. (Original post by MatthewTG)
How do i change the polar form of complex numbers to cartesian form?
You don't need to do anything since MATLAB expresses each form:

in the form when you enter it. So whichever form you enter your complex number, it will get turned into Cartesian.
6. (Original post by RDKGames)
You don't need to do anything since MATLAB expresses each form:

in the form when you enter it. So whichever form you enter your complex number, it will get turned into Cartesian.
I have cartesian matlab results and polar written results. I need to change one set of results to the other form to compare results.

### Related university courses

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: February 8, 2017
Today on TSR

### Edexcel GCSE Maths Unofficial Markscheme

Find out how you've done here

Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams