Why Matrix dimensions do not agree?

8 ビュー (過去 30 日間)
Marcel Langner
Marcel Langner 2018 年 11 月 4 日
コメント済み: Marcel Langner 2018 年 11 月 4 日
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 件のコメント
madhan ravi
madhan ravi 2018 年 11 月 4 日
upload your file by clicking the paper clip button
Marcel Langner
Marcel Langner 2018 年 11 月 4 日
Uploaded file

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2018 年 11 月 4 日
編集済み: Bruno Luong 2018 年 11 月 4 日
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 件のコメント
Bruno Luong
Bruno Luong 2018 年 11 月 4 日
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 2018 年 11 月 4 日
Nice thanks a lot!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by