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

Matlab equation problem

  1. Feb 1, 2008 #1
    Hello, I am trying to solve the following system of equations simultaneously with matlab:


    Unknowns are B, P, and S.

    I have tried the following code which yields an answer:

    syms B P S;

    [B,P,S] = solve((.3*cos(B)*cos(P)*cos(pi/3))+(.2*sin(pi/3))-(.3*sin(B)*sin(pi/3))+S, (.3*cos(B)*sin(P))-.15, (.2*cos(pi/3))-(.3*cos(B)*cos(P)*sin(pi/3))-(.3*sin(B)*cos(pi/3)));

    // note that the above is in one single line.
    Unfortunately the answer is given to me in the form of another equation with extremely long numbers. I need matlab to give me an answer in the form of one number, how can this be done?

    If all else fails I heard that this can be easily done in Maple, but I have no idea how to use it.

    Thanks in advance.
  2. jcsd
  3. Feb 2, 2008 #2
    Never mind, one my friends figured it out, you just use the eval command to get a numerical answer. i.e. eval(B) to get B.
  4. Feb 21, 2008 #3
    Just out of curiosity, where does these equations come from? Robotics? I mean what is your system that is under investigation.
  5. Mar 2, 2009 #4
    how to plot this equation?
    help me
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook