필터 지우기
필터 지우기

Solve funcion shows empty syms variables as result

조회 수: 2 (최근 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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by