1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Solving for variables in matlab

  1. Apr 2, 2009 #1
    i need to make a code that can sole the following, finding the value of Sz
    given the following vectors

    S=[ -6, -6, -Sz]
    P=[ 0 -6 -3]
    Q=[ 5 4 -9]

    i need to make a code that can find Sz so that
    a)S [tex]\bot[/tex]P

    i have managed to make matlab give me a condition for [tex]\bot[/tex], for example, what i set up is:

    >>S=[ -6, -6, -Sz];
    >>P=[ 0 -6 -3];
    >>Q=[ 5 4 -9];

    matlab returns
    answer =


    and i know that answer=0, therefore Sz=-12, but how do i get MATLAB to tell me that Sz=-12??
  2. jcsd
  3. Apr 17, 2009 #2
    build a string that is

    '36+3*Sz = 0'

    teh num2sr() command may help if the answer is not 0 all the time

    then its just:
    >> solve('36+3*Sz = 0')
    Last edited: Apr 17, 2009
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook