Having trouble solving system of equations

1 visualización (últimos 30 días)
Josh Gillis
Josh Gillis el 18 de Feb. de 2019
Editada: Stephan el 18 de Feb. de 2019
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)

Respuestas (2)

Star Strider
Star Strider el 18 de Feb. de 2019
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 el 18 de Feb. de 2019
Editada: Stephan el 18 de Feb. de 2019
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

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by