Solving for variables in matlab

  • Thread starter Thread starter Dell
  • Start date Start date
  • Tags Tags
    Matlab Variables
Click For Summary
SUMMARY

This discussion focuses on solving for the variable Sz in MATLAB given specific vector conditions. The user has established the vectors S, P, and Q, and derived the equation 36 + 3*Sz = 0 using MATLAB's symbolic capabilities. The solution for Sz is determined to be -12. The user seeks guidance on how to automate this process in MATLAB to derive Sz directly from the equation.

PREREQUISITES
  • Familiarity with MATLAB syntax and commands
  • Understanding of vector operations and orthogonality
  • Knowledge of symbolic computation in MATLAB
  • Experience with the solve() function in MATLAB
NEXT STEPS
  • Explore MATLAB's symbolic toolbox for advanced equation solving
  • Learn about vector orthogonality and its implications in MATLAB
  • Investigate the use of the num2str() function for string manipulation
  • Study the implementation of cross products and their properties in MATLAB
USEFUL FOR

Mathematics students, engineers, and data scientists who are using MATLAB for vector analysis and symbolic computation.

Dell
Messages
555
Reaction score
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??
 
Physics news on Phys.org
build a string that is

'36+3*Sz = 0'

the num2sr() command may help if the answer is not 0 all the timethen its just:
>> solve('36+3*Sz = 0')
 
Last edited:

Similar threads

  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K