Integrating the results of state space output(ode45)

8 visualizaciones (últimos 30 días)
Basetsana Sebolao
Basetsana Sebolao el 19 de Mayo de 2021
Respondida: Torsten el 19 de Mayo de 2021
Hi everyone
This is a question that I asked previously however It was not posed correctly;
I solved a state space equation using a function and 0de45, I have attached a picture of my function.
By running the below code in the command window, the plots of y(1), y(2), y(3) and y(4) are generated against time..After plotting y(1), y(2), y(3), I am trying to plot the integral functions of y(1), y(2), y(3) ...however, I am having a hard time plotting the integrals. please kindly assist, thank you in advance!
tspan = [0 0.005];
iniCon = [0; 0; 0; 0];
[t,y] = ode45(@sys, tspan, iniCon);
figure
cols = size(y,2);
for k = 1:cols
subplot(cols,1,k)
plot(t, y(:,k))
grid
xlim([0 1.5E-4])
title(sprintf('y_{%d}',k))

Respuestas (1)

Torsten
Torsten el 19 de Mayo de 2021
Alternatively to the solution I suggested previously, you can use Matlab's "cumtrapz".

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by