0

Help. I am trying to solve this system of nonlinear equations in MATLAB for a homework assignment. I have tried wolfram alpha and this online equation solver, and neither of them work.

I have tried my graphing calculator and it keeps saying non algebraic variable or expression.

These are my two equations in two unknowns:

.75*(1100)= x*10^(6.82485-943.453/(T+239.711))

25*1100=(1-x)*10^(6.88555-1175.817/(T+224.887)

I don't quite understand how to use MATLAB to solve this system. Please help.

am304
  • 13,758
  • 2
  • 22
  • 40
user2928537
  • 31
  • 2
  • 8

1 Answers1

2

You want the function fsolve in Matlab. Define a function myfun that returns [0,0] at the solution, then run fsolve(myfun,x0). x0 is a guess for the solution.

Define myfun:

function F = myfun(x)
F = [<put modified eqt1 here>;
<put modified eqt2 here>;];

Save it. Then solve:

x0 = [1,1];      
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(@myfun,x0,options) % Call solver 
BKay
  • 1,397
  • 1
  • 15
  • 26
  • To elaborate on this answer, your function should probably look like this: `function y = my_fun(x) y(1) = x(1)*10^(6.82485-943.453/(x(2)+239.711)) - 0.75*1100; y(2) = (1-x(1))*10^(6.88555-1175.817/(x(2)+224.887) - 25*1100; end` For more details, see the doc on `fsolve`: http://www.mathworks.co.uk/help/optim/ug/fsolve.html. You need the Optimization Toolbox. – am304 Nov 15 '13 at 15:52
  • +1 for answering the question and still leave some for OP to do (imo, since this is an assignment, that's the best way to answer) – Stewie Griffin Nov 15 '13 at 17:01