Effacer les filtres
Effacer les filtres

Solve funcion shows empty syms variables as result

2 vues (au cours des 30 derniers jours)
alessiadele
alessiadele le 23 Fév 2019
Commenté : alessiadele le 25 Fév 2019
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!

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Fév 2019
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 commentaires
Walter Roberson
Walter Roberson le 24 Fév 2019
Code Attached.
The answers will be in fields of the structure sol
alessiadele
alessiadele le 25 Fév 2019
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!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by