Info

This question is closed. Reopen it to edit or answer.

Solving multiple algebraic equation

1 view (last 30 days)
Aqmar Azlan
Aqmar Azlan on 31 Jul 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comments
Walter Roberson
Walter Roberson on 31 Jul 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.
Aqmar Azlan
Aqmar Azlan on 31 Jul 2019
Got it ! Thank you for your help

Answers (1)

Mahesh Taparia
Mahesh Taparia on 5 Aug 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:

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!