divergence results using ode45 in .m-file and using ode45 simulink

조회 수: 2 (최근 30일)
Gustavo
Gustavo 2012년 4월 27일
Hi everyone,
I'm simulating an ODE in simulink, using a s-function, to obtain the time response and do the system analysis. When I write this ODE in a .m-file and use the ode45 solver to obtain the time response of the system, i have a similar results for some variations in the input variable, but when the value of the input variable decreases, the results of the .m-file is different.
Anyone know why is this occuring?
best regards,
Gustavo

답변 (2개)

Richard Brown
Richard Brown 2012년 4월 29일
Try forcing ode45 to use time steps no bigger than the simulink ones, i.e.
opts = odeset('MaxStep', 0.1); %substitute 0.1 for the simulink step size
ode45(..., opts);

Jan
Jan 2012년 4월 28일
Either there is a bug in the program.
Or the solution is instable. E.g. solutions of chaotic deterministic systems are instable and tiny differences in the intermediate solutions can lead to large differences in the final position. You can check this by an analysis of the sensitivity to variations of the initial values.
  댓글 수: 1
Gustavo
Gustavo 2012년 4월 29일
Hi Jan Simon,
My model is a thermodynamic system and i'm comparing the simulink and .m file output with the measured data (the system is stable). The simulink model is validated, but the .m file have a divergence in a boundary condition, specifically the oil flow.
The model that i'm simulating is that you helped in my other question (a PDE system).
I dont understood when you said to check the solution by an analysis of the sensitivity. Can you explain? i dont have much experience in numerical simulation of PDEs.
best regards,
Gustavo

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

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by