I cannot figure out how to solve for k1, k2, k3, k4 simultaneously using the values for the variable listed in the table.
Show older comments

7 Comments
Alan Stevens
on 6 Feb 2022
Look up help on fminsearch.
Provide a Matlab worksheet with your initial attempt.
Star Strider
on 6 Feb 2022
Post the code written to solve this.
It is actually straightforward, however there are some subtleties involved when coding to solve a matrix of dependent variables.
Lindsay Veltri
on 6 Feb 2022
Lindsay Veltri
on 6 Feb 2022
Edited: Walter Roberson
on 11 Jan 2024
Star Strider
on 6 Feb 2022
Coding the left-hand-side (LHS) is not necessary, and is actually in error.
For example, the first equation, instead of being:
GnGn == GnGn0 * (exp(-(a + b)*t))
would be more appropriately coded as:
k(5) .* exp(-(k(1) + k(2)).*t)
since the parameters to be estimated need to be passed as a vector. They are already appropriately referred to in this context. The LHS is implicitly provided in the regression, providing that the columns of the regression match the columns in the dependent variables matrix.
Please re-code them as a function of the parameters and independent vairable, and provide the dependent variable matrix and the independent fairable vector (‘Time’).
They can be coded as an anonymous function, and the function arguments shoud be ‘k’ and ‘t’, for example with respect to the first equation:
Geqn = @(k,t) [k(5) .* exp(-(k(1) + k(2)).*t)]
The kinetic parameters are ‘k(1)’ through ‘k(4)’ so additional parameters to be estimated are ‘k(5)’ through ‘k(8)’ and correspond to ‘GnGn’ to ‘GG’. Here, ‘k(5)’ is ‘GnGn’ and is to be estimated as a parameter.
I leave the coding of the equations and the matrix to you.
.
Lindsay Veltri
on 12 Feb 2022
Edited: Walter Roberson
on 11 Jan 2024
Hi Lindsay,
To assist you effectively, it would be helpful to know the specific problem that you're encountering. Your code is able to provide a set of solution when executed.
t = 10; GnGn0 = 9.1; GnGn = 5.4; GnG = 2.9; GGn = 0.5; GG = 0.2;
syms a b c d
eqns = [ GnGn == GnGn0 * (exp(-(a + b)*t)), GnG == ((a*GnGn0)/(c-(a+b)))*((exp(-(a+b)*t))-exp(-c*t)), GGn ==(b*GnGn0/d-(a+b))*(exp(-(a+b)*t)-exp(-d*t)), GG == c*a*GnGn0/ c-(a+b)*(exp(-(a+b)*t)/(-(a+b))+(exp(-c*t))/(-(a+b))+(exp(-c*t)/c)+(1/(a+b))-(1/c)+((d*GnGn0)/(d-(a+b))*(exp(-(a+b)*t)/-(a+b))+(exp(-d*t))/d)+1/(a+b)-1/d)];
S = solve (eqns, [a b c d] )
There is only one warning that MATLAB is not able to provide solution sybolically, but it is providing a numerical solution.
Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!