필터 지우기
필터 지우기

lsqcurvefit doesn't curve fit

조회 수: 9 (최근 30일)
Matthew Hunt
Matthew Hunt 2019년 2월 13일
댓글: Matthew Hunt 2019년 2월 13일
I have a model which I want to paramtrise using lsqcurvefit. I have 10 parameters that I must find and I have 10 pieces of data (or more) that I can call on. I set up my function that I want to minimise including the function which includes the model. When I use 10 points I get the message that a minimum is possible and when I plot the solution using the parameters and compare it against the experimental data, I get completely different curves, the solution should overly the points I get but that just isn't the case.
Any idea why this would happen?
Mat

답변 (2개)

Star Strider
Star Strider 2019년 2월 13일
Use as many data as you have. Also, nonlinear parameter estimation techniques are very sensitive to the initial estimates (that you give to the routine to start with), and an inaccurate set can cause the routine to end up in a local minimum rather than a minimum that is much closer to the correct parameters. Choosing the correct values can be challenging.
If you repeatedly have problems guessing the correct initial parameter values, use one of the Global Optimization Toolbox functions (such as the genetic algorithm ga function) to search out the best parameter set. Those take time, however they are usually succesful. (For ga, begin with a large initial population, so it has a better probability of discovering the best parameter set.)
  댓글 수: 16
Matthew Hunt
Matthew Hunt 2019년 2월 13일
function G = Greens_fn(D,mu_n,r,t,r_bar)
%This is the Green's function for spherical diffusion equation
%Solution can be found in A.D. Polyanin. The Handbook of Linear Partial Differential Equations
%for Engineers and Scientists, Chapman & Hall, CRC 17
G=zeros(length(t),length(r_bar));
N_t=length(t);
N=length(mu_n); %Number of terms used in Green's function series
for i=1:N
for j=1:N_t
G_i(j,:)=(2*r_bar/r).*((1+mu_n(i)^-2).*sin(mu_n(i)*r).*sin(mu_n(i)*r_bar).*exp(-D*mu_n(i)^2*t(j))); %Ther series part of the Greens function
G(j,:)=G(j,:)+G_i(j,:); %Adding uo the terms of the series
end
end
for i=1:N_t
G(i,:)=G(i,:)+3*r_bar.^2; %Adding the final part to give the Green's function
end
end
Matthew Hunt
Matthew Hunt 2019년 2월 13일
function V=terminal_voltage(V_exp,I_app,mu_n,t,X,SOC_a,SOC_c,OCV_c,OCV_a)
gamma_plus=X(5);
gamma_minus=X(6);
nu_plus=X(9);
nu_minus=X(10);
SOC_cathode=cathode_c(I_app,mu_n,1,t,X);
SOC_anode=anode_c(I_app,mu_n,1,t,X);
O_plus=interp1(1-SOC_c,OCV_c,SOC_cathode);
O_minus=interp1(SOC_a,OCV_a,SOC_anode);
V=eta_plus(SOC_cathode,I_app,gamma_plus,nu_plus)-eta_minus(SOC_anode,I_app,gamma_minus,nu_minus)+O_plus-O_minus-V_exp';

댓글을 달려면 로그인하십시오.


Matt J
Matt J 2019년 2월 13일
편집: Matt J 2019년 2월 13일
You could have a bug in your model function, such that it is not implementing the curve you that you think it is. What happened when you used your model function code to generate a curve with known parameters? Did the curve look as expected?
  댓글 수: 1
Matthew Hunt
Matthew Hunt 2019년 2월 13일
The model function is fine.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by