Simulating dynamics for an autonomous system
Mostrar comentarios más antiguos
Hello. I am looking to simulate the dynamics of an autonomous system represented by the following equations:
x1dot=-ax1+x2
x2dot=-bx2+u
udot=-cu
I need to simulate the dynamics for 100 random values of x1, x2, and u all for (t=0) and 100 random values of the constants a,b,c. After performing Lyapunov analysis with the given Lyapunov candidate function of V(zeta)=0.5x1^2+0.5x2^2+0.5u^2 where zeta is a function of x1,x2, and u, I identified constraints for a, b, and c to be:
a>0
b>1/a
c>1/2
I am knew to plotting differential equations but from what I have seen online I think I need to use the ode45 function. My code for x1dot is as follows:
function [x1dot] = f(x1,x2)
x1dot=-a*x1+x2;
end
[x1,x2]=ode45('f',[0,200],0);
plot(x1,x2)
If I assign a value to a, the code will run, but I am confused on how to assign 100 random variables to a while also constraining it to be greater than zero. I also am confused on how to assign 100 random values to x1, x2, and u and how to plot each of them versus time on their own plot with each of the 100 trajectories showing. I am pretty stuck on this issue so any help is much appreciated. Thanks.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Computations en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
