Fit parameters to a non linear differential equation of second order

3 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Shaunak
Shaunak il 10 Giu 2025
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!

Categorie

Scopri di più su Systems of Nonlinear Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by