[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Solving for two unknown variables

**From**: |
Sebastian Schöps |

**Subject**: |
Re: Solving for two unknown variables |

**Date**: |
Thu, 27 Apr 2017 02:26:04 -0700 (PDT) |

JMCB23 wrote
>* As I'm new to Octave and haven't used matlab in about 3 years, I'm just*
>* having a bit of trouble trying to solve for two unknowns simultaneously: *
>* *
>*>> aa = 0.3;*
>*>> S0 = 342.5;*
>*>> ta = 0.53;*
>*>> oo = 5.67e-8;*
>*>> as = 0.11;*
>*>> taa = 0.06;*
>*>> aaa = 0.31;*
>*>> c = 2.7;*
>* *
>* (aa*S0)+(ta*S0)+(2*oo*Ta^4)+(taa*oo*Ts^4)+(aaa*oo*Ts^4)=(S0)+(as*ta*S0)+(c*(Ts-Ta)+oo)*(Ts^4)*
>* *
>* As shown in the equation above, the two values I'm trying to find are that*
>* of Ta and Ts, however I'm not sure what function or coding to solve this*
>* equation. If anyone could assist me with this, that would be great.*
>* Thanks!*
I had a very quick look to your equation. Are you sure that that there is a
solution and that the solution is unique? It's necessary to have as many
equations as variables.
Let assume that the problem is well posed, then you have to rewrite your
equation as a root-finding problem, i.e. "f(x) = 0", see
https://en.wikipedia.org/wiki/Root-finding_algorithm.
So, after having declared you variables, this may look in Octave like this
f=@(x)
((aa*S0)+(ta*S0)+(2*oo*x(1)^4)+(taa*oo*x(2)^4)+(aaa*oo*x(2)^4)-(S0)+(as*ta*S0)+(c*(x(2)-x(1))+oo)*(x(2)^4));
If you are lucky, fsolve will give you a a good approximation of the answer
(read: "help fsolve").
Seb.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Solving-for-two-unknown-variables-tp4683064p4683065.html
Sent from the Octave - General mailing list archive at Nabble.com.