MATLAB Answers

potting the integral of a state

2 views (last 30 days)
Basetsana Sebolao
Basetsana Sebolao on 19 May 2021
Edited: Paul on 20 May 2021
Hi everyone
I would like to enquire about integralting a state.Afer solving a state space equation on matlab sing ode45, how does one go about plotting the integral of a state, please kindly assist, thank you in advance!

Answers (1)

Torsten on 19 May 2021
If y'(t)=f(t,y) is the state space equation, you get the integral of y by simultaneously solving z'(t)=y(t), z(0)=0.
Paul on 19 May 2021
Implement what @Torsten suggested.
Change the last line of sys to:
di = [Ai + Bv; i];
Change iniCon to:
iniCon = [0;0;0;0;zeros(4,1)]; % assuming you want the integrals of y(i) to start from zero
Then y will have 8 states, the first 4 are i and the second 4 are the integrals of i

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!