Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

MATLAB Error in solving equations

$
0
0
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=1';
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='cPZt = cPZ + cPZHP + cPZCOOM + cPHPZCOOM + cMOOCPZCOOM';
eq9='cHP = cPZCOOM + 2*cMOOCPZCOOM + cHCO3M + 2*cCO32M + cOHM - cPZHP';
eq10='cCO2t = cCO2 + cHCO3M + cCO32M + cPZCOOM + cPHPZCOOM + 2*cMOOCPZCOOM';
as = solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,'cP Z','cHP','cPZHP','cPZCOOM','cCO2','cMOOCPZCOOM','c PHPZCOOM','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.

Viewing all articles
Browse latest Browse all 2703

Trending Articles