MATLAB Answers

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

8 views (last 30 days)
liqun fang
liqun fang on 21 Jun 2021
Commented: liqun fang on 23 Jun 2021
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????

Accepted Answer

Paul
Paul on 22 Jun 2021
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 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!