How to solve 7 unknowns with 7 equations with ln

17 views (last 30 days)
Shazreen
Shazreen on 18 Nov 2014
Answered: MA on 18 Nov 2014
I have 7 equations containing 7 unknowns: nMj, nMk, pHj, pMj, pHk, pMk, Am. Following are my equations.
eq 1: 50=nMj+nMk
eq2: 500=pHj+pMj
eq3: 20=pHk+pMk
eq4: pHj=(22500/(45+nMj))
eq5: pHk=(8100/(405+nMk))
eq6: 405=(0.000343*Am*((450-pHj)/ln((450-pHk)/(pHj-pHk))))
eq7: nMk=(0.0000555*Am*((50-pMj)/ln((50-pMk)/(pMj-pMk))))
Below is the code that I've tried to put in. Tried to use the 'solve' function to solve the problem but failed. Could anyone enlighten me on how to solve this? Thank you.
syms nMj nMk pHj pMj pHk pMk Am
eq1=50-nMj-nMk
eq2=500-pHj-pMj
eq3=20-pHk-pMk
eq4=pHj-(22500/(45+nMj))
eq5=pHk-(8100/(405+nMk))
eq6=405-(0.000343*Am*((450-pHj)/ln((450-pHk)/(pHj-pHk))))
eq7=nMk-(0.0000555*Am*((50-pMj)/ln((50-pMk)/(pMj-pMk))))
solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,nMj,nMk,pHj,pMj,pHk,pMk,Am)

Answers (2)

Roger Stafford
Roger Stafford on 18 Nov 2014
Try using 'log' instead of 'ln' for the natural logarithm. I don't think 'solve' recognizes 'ln'.

MA
MA on 18 Nov 2014
clear all
close all
clc;
syms nMj nMk pHj pMj pHk pMk Am
eq1=50-nMj-nMk;
eq2=500-pHj-pMj;
eq3=20-pHk-pMk;
eq4=pHj-(22500/(45+nMj));
eq5=pHk-(8100/(405+nMk));
eq6=405-(0.000343*Am*((450-pHj)/log((450-pHk)/(pHj-pHk))));
eq7=nMk-(0.0000555*Am*((50-pMj)/log((50-pMk)/(pMj-pMk))));
S=solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7);
display('nMj nMk pHj pMj pHk pMk Am')
S=[S.nMj S.nMk S.pHj S.pMj S.pHk S.pMk S.Am]

Tags

Community Treasure Hunt

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

Start Hunting!