Solving for variables in matlab

  • Thread starter Dell
  • Start date
  • #1
590
0
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
b)S[tex]\bot[/tex]Q
c)S[tex]\bot[/tex](PxQ)
d)(SxP)[tex]\bot[/tex]Q

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

>>Sz=sym('Sz');
>>S=[ -6, -6, -Sz];
>>P=[ 0 -6 -3];
>>Q=[ 5 4 -9];
>>answer=S*P'


matlab returns
answer =

36+3*Sz


and i know that answer=0, therefore Sz=-12, but how do i get MATLAB to tell me that Sz=-12??
 

Answers and Replies

  • #2
167
0
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:

Related Threads on Solving for variables in matlab

  • Last Post
Replies
9
Views
7K
  • Last Post
Replies
2
Views
11K
  • Last Post
Replies
7
Views
15K
Replies
4
Views
8K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
1K
Replies
1
Views
1K
  • Last Post
Replies
8
Views
6K
Replies
4
Views
6K
  • Last Post
Replies
1
Views
2K
Top