## Matlab

Moderators: None (Apply to moderate this forum)
Number of posts: 2147

This Forum Only

MATLAB Error in solving equations Posted by stephensmith on 2 Jul 2012 at 4:10 AM
My aim is to solve 10 equations and with 10 variables and 3 parameters. So, ultimately, I need the 10 variables solved in terms of the other 3 parameters.

'cPZ','cHP','cPZHP','cPZCOOM','cCO2','cMOOCPZCOOM','cPHPZCOOM','cCO32M','cHCO3M','cOHM'

These are the 10 variables whose values are to be found and the three parameters are K1,K2,K3

clc;
clear all;
close all;
syms cPZ cHP cPZHP cPZCOOM cCO2 cMOOCPZCOOM cPHPZCOOM cCO32M cHCO3M cOHM K1 K2 K3;
eq1='K1 = cPZ*cHP/cPZHP';
eq2='K2 = cPZCOOM*cHP/(cPZ*cCO2)';
eq3='K3 = cMOOCPZCOOM*cHP/(cPZCOOM*cCO2)';
eq4='cPZCOOM*cHP/cPHPZCOOM-0.00000000013183=0';
eq5='cCO32M*cHP/cHCO3M-1.1356*10^(-128)=0';
eq6='cHCO3M*cHP/cCO2-1.0723*10^(-124)=0';
eq7='cOHM*cHP+5.3907*10^(-91)=0';
eq8='0.2278 = cPZ + cPZHP + cPZCOOM + cPHPZCOOM + cMOOCPZCOOM';
eq9='cHP = cPZCOOM + 2*cMOOCPZCOOM + cHCO3M + 2*cCO32M + cOHM - cPZHP';
eq10='0.1923 = cCO2 + cHCO3M + cCO32M + cPZCOOM + cPHPZCOOM + 2*cMOOCPZCOOM';
as = solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,'cPZ','cHP','cPZHP','cPZCOOM','cCO2','cMOOCPZCOOM','cPHPZCOOM','cCO32M','cHCO3M','cOHM')

This is my code. When I try to run this, I get something called Mupad Internal Error(4 times) which says MCM_Compare_Unknown. And later on, I also get a warning: Explicit solution could not be found. I suspect the error to be in the eq4,eq5,eq6,eq7 because until I changed these four lines, this error was not popping up. I have never seen this error earlier in Matlab. Please help me with it.

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic