Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab - matrix expressions

  1. Mar 27, 2008 #1
    1. The problem statement, all variables and given/known data

    Hi, this isn't a homework question as such, but I'd appreciate some advice as it is a part of a project that I'm doing.

    I'm trying to write some matlab code and need to create a matrix and multiply some value by this matrix

    R(*)=[cos(*) sin(*) 0; -sin(*) cos(*) 0; 0 0 1]

    but I'm not sure how to write/use it. Basically I have a formula whereby a value is multiplied by this matrix (or visa versa), however I'm not sure how to relate the two in code.
    The stars in the above matrix represent the value to be multiplied, so do I need to simply write the matrix as:

    R=[cos sin 0; -sin cos 0; 0 0 1]


    R()=[cos() sin() 0; -sin() cos() 0; 0 0 1]

    or indeed something else for this operation to work??

    p.s An example of the operation that I'm trying to do is:

    temp = R(-MarsAng)*[a_mars;0;0];


    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted