Warning: The solutions are parameterized by the symbols: z

33 vues (au cours des 30 derniers jours)
Ross Hanna
Ross Hanna le 18 Avr 2017
Commenté : Andrew Newell le 20 Avr 2017
Hi There
This is my first time posting, as i am new to matlab, so apologies if i have missed some etiquette that i know there is on some forums.
i am trying to calculate some values for angles of a mechanical arm with a linkage system. i have drawn out the system and found all the relationships i possibly can using the cosine rule and put them all into the file, hence some are not applicable to this bit of code.
my problem is i am trying to use the solve function to solve the following equation for zeta;
k2=sqrt(s^2+h^2-2*s*h*cos(theta+zeta))
i can find the solution of this using wolframalpha as;
zeta=-acos((h^2-k^2+s^2)/(2*h*s))-t
however if i write solve(k2, zeta) it comes up with the following error;
Warning: The solutions are parameterized by the symbols: z7.
To include parameters and conditions in the solution, specify the 'ReturnConditions' option.
> In solve>warnIfParams (line 500)
In solve (line 356)
Warning: The solutions are valid under the following conditions: (in((theta + z7 + acos((H^2 + 270400)/(1040*H)))/(2*pi), 'integer') | in((theta + z7 - acos((H^2 + 270400)/(1040*H)))/(2*pi), 'integer')) & -1 <= (H^2 +
270400)/(1040*H) & (H^2 + 270400)/(1040*H) <= 1 & 0 < z7.
To include parameters and conditions in the solution, specify the 'ReturnConditions' option.
> In solve>warnIfParams (line 507)
In solve (line 356)
I know that the answer for theta and zeta are 0.271 and 0.757 at the point where l is 330, i could just write in what the rearrangement is but that kind of defeats the object of having a maths package in my eyes and i would like to know for future knowledge what i'm doing wrong.
Hopefully someone can help me by telling me i'm an idiot and i've missed something stupid.
Ross
  1 commentaire
Ross Hanna
Ross Hanna le 19 Avr 2017
ok, so i've got past the first problem which is getting matlab to give me an answer other than "z". i did this by making theta and zeta "real" when writing syms. the problem now is its giving me two answers, one positive, one negative. i have tried B=A(A=>0) but it doesnt work. i have tried "assume" but it comes up with the error message
Undefined function 'assume' for input arguments of type 'logical'
any help would be greatly appreciated. thanks

Connectez-vous pour commenter.

Réponse acceptée

Andrew Newell
Andrew Newell le 19 Avr 2017
The function solve is part of the Symbolic Math Toolbox. Are you defining the symbolic variables? If I run this code
syms s h theta zeta
k2=sqrt(s^2+h^2-2*s*h*cos(theta+zeta));
zeta = solve(k2, zeta)
I get
zeta =
- theta - acos((h^2 + s^2)/(2*h*s))
acos((h^2 + s^2)/(2*h*s)) - theta
  2 commentaires
Ross Hanna
Ross Hanna le 20 Avr 2017
Modifié(e) : Ross Hanna le 20 Avr 2017
Thanks for replying. Yes i am defining symbolic variables, not sure if this is the best way but i don't know their values without consulting a 3d model which i am trying to recreate and this is the only way of calculating them.
my problem is that when i run the program it gives me the answers above, but then lower down it has the issue of the error below;
Error using mupadengine/feval (line 163) The number of equations exceeds the number of indeterminates. This is allowed only for polynomial systems.
this is i'm guessing as sol_zeta is giving two outputs. how do i limit solve to one output? thanks
Andrew Newell
Andrew Newell le 20 Avr 2017
If this problem is well formulated, you could try both values of zeta, one at a time, and then determine whether one of them can be ruled out by the mechanical constraints. If not, you may need to think about the physics some more!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by