Hey there! Sign in to join this conversationNew here? Join for free

Complex Numbers - polar to cartesian form - matlab Watch

    • Thread Starter
    Offline

    1
    ReputationRep:
    How do i change the polar form of complex numbers to cartesian form?
    Offline

    7
    ReputationRep:
    (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
    • Thread Starter
    Offline

    1
    ReputationRep:
    (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?
    Offline

    2
    ReputationRep:
    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);
    • Community Assistant
    • Welcome Squad
    Offline

    20
    ReputationRep:
    (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:

    re^{i\theta}
    x+iy
    r(\cos(\theta)+i\sin(\theta))

    in the form x+iy when you enter it. So whichever form you enter your complex number, it will get turned into Cartesian.
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by RDKGames)
    You don't need to do anything since MATLAB expresses each form:

    re^{i\theta}
    x+iy
    r(\cos(\theta)+i\sin(\theta))

    in the form x+iy 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.
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    What newspaper do you read/prefer?
    Useful resources

    Make your revision easier

    Maths

    Maths Forum posting guidelines

    Not sure where to post? Read the updated guidelines here

    Equations

    How to use LaTex

    Writing equations the easy way

    Student revising

    Study habits of A* students

    Top tips from students who have already aced their exams

    Study Planner

    Create your own Study Planner

    Never miss a deadline again

    Polling station sign

    Thinking about a maths degree?

    Chat with other maths applicants

    Can you help? Study help unanswered threads

    Groups associated with this forum:

    View associated groups
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.