Fit parameters to a non linear differential equation of second order
조회 수: 4 (최근 30일)
이전 댓글 표시
Dear Matlab Community,
I have a non linear differenital equation of first order: L*(dQ/dt)=a*Q+b*(w^2)+c*H+d*Q*(w^2). I have measuring data for Q,w and H and I want to find my parameters L, a, b, c, d. Any idea how I can do this?
Would be really thankful for your help!
Yours
Ann
댓글 수: 0
답변 (1개)
Shaunak
2025년 6월 10일
Hi Ann,
It is my understanding that you have the time-series data for Q, w, and H, and you'd like to estimate five parameters in a nonlinear differential equation that models dQ/dt as a function of these variables.
You can approach this as a nonlinear regression problem using MATLAB’s “lsqnonlin” function from the Optimization Toolbox. You can refer to the following application of the “lsqnonlin” function:
% Given data:
t = time_data; Q = Q_data; w = w_data; H = H_data;
dQdt = gradient(Q, t); % Approximate dQ/dt numerically
% Residual function for least-squares fitting
errorFun = @(p) (p(2)*Q + p(3)*w.^2 + p(4)*H + p(5)*Q.*w.^2) / p(1) - dQdt;
% Initial guess for [L, a, b, c, d]
params0 = [1, 1, 1, 1, 1];
params = lsqnonlin(errorFun, params0);
This will return the parameter estimates that minimize the error between your model and the measured data.
You can refer to the following MathWorks documentation for more information on the “lsqnonlin” function:
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!