Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Solving multiple algebraic equation
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to solve 3 unknown using the following code. Am I doing this right ?
>> clear all
>> syms x y z
>> eqns=[x==(0.134+0.01*sin(z))/0.464189, 0.134*z==0.01*cos(z), y==z/x];
>> S=solve(eqns,[x y z])
Warning: Cannot solve symbolically. Returning a numeric approximation instead.
> In solve (line 303)
S =
struct with fields:
x: [1×1 sym]
y: [1×1 sym]
z: [1×1 sym]
>> S.x
ans =
0.29027727131273067299254520400093
>> S.y
ans =
0.25637661763413173595586063384135
>> S.z
ans =
0.074420304995223068940034251420538
2 commentaires
Walter Roberson
le 31 Juil 2019
Yes, provided you want to restrict to reals.
However in this situation, you only need to solve the second equation. The z you get from that defines what x must be, and then the third equation defines y in terms of the x and z.
Réponses (1)
Mahesh Taparia
le 5 Août 2019
Hi,
Your solution is correct.
Use ‘S=vpasolve(eqns,[x y z]) ‘ instead of using ‘solve’ command, to avoid warning. Your solution is an approximate to your exact solution. By default, ‘vpa’ uses 32 significant decimal digits of precision, you can change the precision using digits command. For further information, you can refer the following link:
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!