Non Linear Regression Problem

I have tried to attempt this question however I don't know if I'm on the right track. I have already done (i), my difficulty is in (ii).
clear all
clc
syms x y a b
X=[1:1:10];
Y=[0.5379,0.827,1.2654,1.5324,1.717,1.3983,1.6844,1.6892,1.506,1.707];
a = [1;0;0;0;0;0;0;0;0;0;0];
b = [1;0;0;0;0;0;0;0;0;0;0];
c = [0;0;0;0;0;0;0;0;0;0;0];
u = [((a(1)*x)/(b(1)+x)) , ((a(1)*2*x)/(b(1)+2*x)), ((a(1)*3*x)/(b(1)+3*x)), ((a(1)*4*x)/(b(1)+4*x)), ((a(1)*5*x)/(b(1)+5*x)), ((a(1)*6*x)/(b(1)+6*x)), ((a(1)*7*x)/(b(1)+7*x)), ((a(1)*8*x)/(b(1)+8*x)), ((a(1)*9*x)/(b(1)+9*x)), ((a(1)*10*x)/(b(1)+10*x))]';
B0=[a(1);b(1)];
U = [0;0;0;0;0;0;0;0;0;0;0];
for i=2:11
U(i-1) = [((a(i-1)*1)/(b(i-1)+1)) , ((a(i-1)*2)/(b(i-1)+2)), ((a(i-1)*3)/(b(i-1)+3)), ((a(i-1)*4)/(b(i-1)+4)), ((a(i-1)*5)/(b(i-1)+5)), ((a(i-1)*6)/(b(i-1)+6)), ((a(i-1)*7)/(b(i-1)+7*x)), ((a(i-1)*8)/(b(i-1)+8)), ((a(i-1)*9)/(b(i-1)+9)), ((a(i-1)*10)/(b(i-1)+10))]';
Jac = jacobian([((a*1)/(b+1)) , ((a*2)/(b+2)), ((a*3)/(b+3)), ((a*4)/(b+4)), ((a*5)/(b+5)), ((a*6)/(b+6)), ((a*7)/(b+7)), ((a*8)/(b+8)), ((a*9)/(b+9)), ((a*10)/(b+10))], [a,b] );
r = u - U(i-1);
c = [a(i-1);b(i-1)] - inv(J(i-1)'.* J(i-1)).*(J(i-1)'.*r(i-1));
c
a(i) = c(1);
b(i) = c(2);
end

 Accepted Answer

That equation is "the rate equation" and I have attached a demo for solving it using fitnlm().
% Fit a vertically shifted version of the the Fluorescence Recovery Curve (Michaelis-Menten function).
% One common non-linear equation is the Michaelis-Menten function,
% which is used to describe the reaction rate as a function of substrate concentration.
% The Michaelis-Menten function is characterized by a steep rise that gradually flattens into a plateau.
For your assignment you would want the Equation 1 version where no vertical offset is allowed (shown by the red equation above, not the green one).

5 Comments

Thank you for your help!
However, I need to use the equations as in the question to find the parameters. I cannot use ( modelFunction = @(b, tbl) b(1) * tbl(:, 1) ./ (b(2) + tbl(:, 1)); )
J, why do you think that the model function is not of the form Y = aX / (b + X)??? It is exactly of that form.
b(1) is a, tbl(:, 1) is X, and b(2) is b. You don't need to do all that stuff with J and B - fitnlm() handles all that internally and just gives you back the coefficients, which is really all you care about.
So what is left in my assignment is to do a for loop to obtain estimates of b(1) and b(2) for 10 times right?
Well it looks like your homework wants you to do it a certain way instead of using the built in function - they want you to do it manually according to their recipe. Sorry, but I don't have the time to devote to it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!