time for parameter estimation using ode 45
이전 댓글 표시
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
nado
2022년 10월 19일
Walter Roberson
2022년 10월 19일
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
2022년 10월 19일
@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
2022년 10월 19일
nado
2022년 10월 19일
nado
2022년 10월 19일
Sam Chak
2022년 10월 19일
@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
2022년 10월 19일
nado
2022년 10월 19일
답변 (1개)
Rajiv Singh
2022년 11월 7일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!