MATLAB Answers

0

Having trouble solving system of equations

Asked by Josh Gillis on 18 Feb 2019
Latest activity Edited by Stephan
on 18 Feb 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)

  0 Comments

Sign in to comment.

Products


Release

R2018b

2 Answers

Answer by 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.

  0 Comments

Sign in to comment.


Answer by Stephan
on 18 Feb 2019
Edited by Stephan
on 18 Feb 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

  0 Comments

Sign in to comment.