nlinfit returns same values

7 ビュー (過去 30 日間)
kate  oucherif
kate oucherif 2011 年 7 月 7 日
Hi, I am having an issue with the nlinfit function in Matlab. I am given some experimental data and trying to fit a curve that I solve for in another file and extract some parameters (ng, Kg) but the nlinfit always returns the same initial guesses. If anybody can help me, I would greatly appreciate it. Below are the files/functions that I used:
This is the main file:
global ng Kg
% exp data
ti=[0;.5;1;1.5;2;2.5;3;3.5;4;4.5;5];% min
Sup=[9.02;7.95;7.24;6.37;5.79;5.42;4.70;4.38;3.91;3.60;3.33];
yi=Sup*10^-3;
% fit estimated parameter to exp data
plot(ti,yi)
Beta=[ng Kg];
Beta0 = [2 .0004 ];
[Beta,resid,J,Sigma] = nlinfit(ti,yi,@esti_j,Beta0);
CI = nlparci(Beta,resid,'jacobian',J)
Beta
This is the file that calls the other 2 functions:(mom_j)
function dudt = mom_j(t,u)
global ng Kg
C_eq = 10^-3;
po = 1277;
sf = 1;
xin = 106*10^-6;
Gode = Kg*(u(4)-C_eq).^ng;
dudt = zeros (4,1);
dudt(1) = 0;
dudt(2) = u(1)*Gode;
dudt(3) = 2*Gode*u(2);
dudt(4) = -po*sf*(3*Gode*u(3));
end
the other function(est_j):
function [t Cf] = esti_j(Beta,ti)
global ng Kg
ng=Beta(1);
Kg=Beta(2);
po = 1277;
sf = 1;
C_eq = 10^-3;
Min = 20*10^-6;
xin = 106*10^-6;
V = 50*10^-6;
c_0 = 9.02*10^-3;
%set of equations describing initial conditions
u0_0 = Min/((xin^3)*po*sf*V);
u1_0 = Min/((xin^2)*po*sf*V);
u2_0 = Min/(xin*po*sf*V);
[t,u] = ode15s(@mom_j,ti,[u0_0 u1_0 u2_0 c_0 ]);

回答 (1 件)

Robert Cumming
Robert Cumming 2011 年 7 月 7 日
do you get any warning messages? If your problem is not solvable - then nlinfit can appear to return the same values, do this and you should see that nlinfit is attempting to change the parameters:
format long
disp ( Beta ) % in your esti_j function
  2 件のコメント
kate  oucherif
kate oucherif 2011 年 7 月 7 日
Hi Robert,
Thank you for taking a look at his. I get the following warnings:
Warning: Rank deficient, rank = 0, tol = 0.0000e+000.
Warning: Some columns of the Jacobian are effectively zero at the solution, indicating that the model is insensitive to some of its parameters...
Warning: Matrix is singular to working precision.
I tried displaying the values of beta as you suggested and they almost don't vary at all:
1.600000000000000 0.000800000000000
1.600000000000000 0.000800000000000
1.600009688727124 0.000800000000000
1.600000000000000 0.000800004844364
I wonder if there are any error in the code itself.Any further suggestions would be extremely helpful! thanks again!
Robert Cumming
Robert Cumming 2011 年 7 月 7 日
nlinfit starts by incrementing the value in small steps (as its showing above) - so that is working, the size of the following increments depends on what the results you get back are.
The warning message is telling you that there is a problem with your data and/or equation - in that it cannot be "fit"

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by