Having trouble solving system of equations
Show older comments
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)
Answers (2)
Star Strider
on 18 Feb 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.
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
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!