Why a function can't get itself in Simulink after two consecutive differentiation and two integration operations?

조회 수: 22 (최근 30일)
I want to implement the functionality described in the following figure.
So I build the Simulink model shown in the below figure.
The results are shown in the below figure. Both results are wrong. Why????

채택된 답변

Paul
Paul 2021년 6월 22일
For the top (continuous) branch, keep in mind that the Derivative block is a numerical approximation and it's output will be very dependent on the solver parameters. I was able to get the expected result by using a Fixed Step solver (ode2) with a Fixed step size of 0.002. Don't forget to the set the Initial condition of Integrator4 to 1. In general, using Derivative block is not recommended and using two in series with each other will likely be very problematic.
For the bottom (discrete) branch, change the Integrator method on both Discrete Time Integrators to Backward Euler. Place a Zero Order Hold block between the Sine Wave and the first Discrete Derivative and set its Sample time to what you want (I used 0.1). Then adjust the Intital Condition parameters on each Discrete Derivative and Discrete Time Integrator so that the output of each block has the desired value at T=0.
  댓글 수: 3
Paul
Paul 2021년 6월 23일
You ask a very important question that you must think about for any model and simulation, particularly for physical systems, that goes well beyond this particular case with Derivative blocks (which you should try to avoid by all means possible). After all, in many cases the model itself is an approximate representation of the actual physical system, and the the simulated solution is a numerical approximation of the solution of the governing equations in your model. So how do you know if you're getting "correct" results? Ideally, you have some idea of what "correct" will look like for the problem at hand so you at least have a qualitative idea the the result looks right. Do some sanity checks on things where you know what the answer should be. Bulid up your model gradually in modules and check and verify each as you go. Understand the trade-offs between various solvers. Experiment with solver parameters, like max step size, etc., and see the sensitivity in the results. Etc. Etc.
liqun fang
liqun fang 2021년 6월 23일
Thank you very much for your answer. My problem is solved. Your answer is very well.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by