Having trouble solving system of equations

1 回表示 (過去 30 日間)
Josh Gillis
Josh Gillis 2019 年 2 月 18 日
編集済み: Stephan 2019 年 2 月 18 日
Hello,
I am trying to have MATLAB solve the following equaitions for C1 and C2 - I thought i could simply use 'solve()' for this but i'm getting a structure response and i need actua results (i would hope real number response) how would it better done? Thanks!
Thanks:
code i'm using:
clear all
close all
clc
syms c1 c2
solve(c1==18*c1-1200+((4.8195*10^-8)*(((0.3*c1+c2)^4)-18^4)),c1==(20*c2-500)/-0.95,c1,c2)

回答 (2 件)

Star Strider
Star Strider 2019 年 2 月 18 日
Use the correct syntax for solve, and use the vpa function to get numeric results:
syms c1 c2
[C1,C2] = solve(c1==18*c1-1200+((4.8195*10^-8)*(((0.3*c1+c2)^4)-18^4)),c1==(20*c2-500)/-0.95, [c1,c2]);
C1v = vpa(C1, 7)
C2v = vpa(C2, 7)
producing:
C1v =
70.579
2057.393 - 3835.412i
2057.393 + 3835.412i
-4581.405
C2v =
21.6475
- 72.72618 + 182.1821i
- 72.72617 - 182.1821i
242.6167
The solved constants retain their full internal precision.

Stephan
Stephan 2019 年 2 月 18 日
編集済み: Stephan 2019 年 2 月 18 日
Hi,
shorter:
syms c1 c2
[sol_c1, sol_c2] = vpasolve(c1==18*c1-1200+((4.8195*10^-8)*(((0.3*c1+c2)^4)-18^4)),c1==(20*c2-500)/-0.95,c1,c2)
Best regards
Stephan

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by