Why Matrix dimensions do not agree?

8 Ansichten (letzte 30 Tage)
Marcel Langner
Marcel Langner am 4 Nov. 2018
Kommentiert: Marcel Langner am 4 Nov. 2018
This is my script:
function Langner_Ue1
load data1 P v;
Vmax3 = 4;
S2 = 40-P;
Km3 = 3;
k1 = 30;
P0 = [Vmax3, Km3, k1];
lsqcurvefit(@Michaelis_Menten_Substratinhibierung_2, P0, S2, v)
figure(2)
plot(S2,v,'r*')
hold on
plot(S2,vMMI2,'r')
hold on
legend('v über S', 'MMI2 über S')
end
function MMI2 = Michaelis_Menten_Substratinhibierung_2(Vmax3, S2, Km3, k1)
MMI2 = (Vmax3.*S2)./(Km3+S2+(S2.^2./k1));
end
Matrix dimensions must agree.
Error in Langner_Ue1>Michaelis_Menten_Substratinhibierung_2 (line 40) MMI2 = (Vmax3.*S2)./(Km3+S2+(S2.^2./k1));
Error in lsqcurvefit (line 213) initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Error in Langner_Ue1 (line 30) lsqcurvefit(@Michaelis_Menten_Substratinhibierung_2, P0, S2, v)
Caused by: Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.
If I perform the function 'Michaelis_Menten_Substratinhibierung_2' directly in the command window there is no failure and verything works fine. Why do I get a failure when I try to run the script?
  4 Kommentare
madhan ravi
madhan ravi am 4 Nov. 2018
upload your file by clicking the paper clip button
Marcel Langner
Marcel Langner am 4 Nov. 2018
Uploaded file

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 4 Nov. 2018
Bearbeitet: Bruno Luong am 4 Nov. 2018
Try this:
load data1 P v;
Vmax3 = 4;
S2 = 40-P;
Km3 = 3;
k1 = 30;
P0 = [Vmax3, Km3, k1];
P = lsqcurvefit(@Michaelis_Menten_Substratinhibierung_2, P0, S2, v);
MMI2 = Michaelis_Menten_Substratinhibierung_2(P, S2);
figure(2)
plot(S2,v,'r*')
hold on
plot(S2,vMMI2,'r')
hold on
legend('v über S', 'MMI2 über S')
end
function MMI2 = Michaelis_Menten_Substratinhibierung_2(P, S2)
Vmax3 = P(1);
Km3 = P(2);
k1 = P(3);
MMI2 = (Vmax3.*S2)./(Km3+S2+(S2.^2./k1));
end
  3 Kommentare
Bruno Luong
Bruno Luong am 4 Nov. 2018
In any optimization function you have to provide the parameters as a vector, up to you to split the vector in a meaningful way.
I just guess because you supply
P0 = [Vmax3, Km3, k1];
So the order of parameters must be as written in Michaelis_Menten_Substratinhibierung_2.
Marcel Langner
Marcel Langner am 4 Nov. 2018
Nice thanks a lot!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by