Solve funcion shows empty syms variables as result

1 回表示 (過去 30 日間)
alessiadele
alessiadele 2019 年 2 月 23 日
コメント済み: alessiadele 2019 年 2 月 25 日
Hi all!
I am spotting another error in my matlab program! My code should carry out a simple system of equations, that I have written as matrices. I've used 'syms' variable to initialize the variables that I should find, and then I've employed 'solve' function to compute the equations.
More precisely, here's the code:
clear r11 r12 r13 r21 r22 r23 r31 r32 r33 tx ty tz
syms r11 r12 r13 r21 r22 r23 r31 r32 r33 tx ty tz
R=[r11 r12 r12; r21 r22 r23; r31 r32 r33];
t=[tx; ty; tz];
eqn1= ip==R*ic+t;
eqn2= mp==R*mc+t;
eqn3= rp==R*rc+t;
eqn4= lp==R*lc+t;
sol=solve([eqn1(:); eqn2(:); eqn3(:); eqn4(:)]);
Unfortunately, the solution returns me empty variables. For example, when I type "r11" in the command window to display its value, the solution is "r11=r11". I have the same error also adding "'ReturnConditions', true" as condition of the function, or using vpasolve instead of solve, or specifying the variables with respect to solve the function (R and t).
Where i am mistaken?
Thank you very much!

採用された回答

Walter Roberson
Walter Roberson 2019 年 2 月 23 日
you are asking to solve 4 equation in 12 variables but you do not specify which variables to solve for . You need to indicate four variables to solve for.
The results will be returned in the struct sol so if r11 was asked to be solved for you would examine sol.r11
  6 件のコメント
Walter Roberson
Walter Roberson 2019 年 2 月 24 日
Code Attached.
The answers will be in fields of the structure sol
alessiadele
alessiadele 2019 年 2 月 25 日
thank you for your help Walter :)
I've tried your code, but it still returns me empty solutions: I've discovered that the problems are the values of *p and *c, in fact carrying out the equations manually, I've noticed that there's no solution! Unfortunately, there's a sort of incompatibility.
Thank you again! I'll sign your answer as right, so someone else could read the post and have some help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by