time for parameter estimation using ode 45
Mostrar comentarios más antiguos
Hello everyone,
I used lsqnonlin to find unknown parameters of an ODE. However, when i run the script, it is taking a long time. Until now, it tooks 25 min and it's the first time i encounter this !
The system i'm solvin consists of 3x3 matrix.
Do you think the time for this is reasonable or there is something going wrong ???
I searched a lot on how to know whether the script is stuck somewhere but i didn't succeed.
Based on your experience, is there any method to know where the code is stuck ?
11 comentarios
nado
el 19 de Oct. de 2022
Walter Roberson
el 19 de Oct. de 2022
Long search time would be expected for stiff systems
We don't know your data vector, so we cannot run your code.
But at least change the line
err=abs(y_exp_surge-y(:,1)).^2; %% y_exp is a vector containing data from experiment
to
err=y_exp_surge-y(:,1); %% y_exp is a vector containing data from experiment
"lsqnonlin" will add the squares of the vector components of "err" internally.
Working with a mass matrix M to solve
M*y'' = K*y + C*y'
instead of multiplying by M^(-1) might help.
Also changing the ODE solver from ODE45 to ODE15S is worth a try.
Bjorn Gustavsson
el 19 de Oct. de 2022
@nado: In addition to @Torsten's comment you might have a problem if your y_exp_surge variable is a row-array. Then the
err=y_exp_surge-y(:,1); %%
would turn err into a numel(time)-by-numel(time) array - which is not what you want. That would correspond to a "very strange fitting problem". My suggestion is that your modified line should be:
err = y_exp_surge(:) - y(:,1); %% just to make sure that you get the residual for each time-step
nado
el 19 de Oct. de 2022
nado
el 19 de Oct. de 2022
nado
el 19 de Oct. de 2022
Sam Chak
el 19 de Oct. de 2022
@nado, looks like system identification problem. Your mass matrix and the damping matrix contain some very large values. So, this might explain why the code takes a long time to run.
I have heard of some people used the non-dimensional approach (through normalization). Perhaps, it may reduce the time taken by lsqnonin to solve the problem.
nado
el 19 de Oct. de 2022
nado
el 19 de Oct. de 2022
Respuestas (1)
Rajiv Singh
el 7 de Nov. de 2022
0 votos
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!