Ceate a vector of state space variable like A=[x(1), x(2), x(3),.....x(21)]
Mostrar comentarios más antiguos
Hi...
How can I create a vector of state space variables by a loop to get
[x(1), x(2), x(3),.....x(21)]
I need this vector to use it in ODE15 as state space variables vector multiplied by other matrices forming DAEs.
Thanks
12 comentarios
Andrew Newell
el 15 de Mzo. de 2015
What vector do you want to create?
Andrew Newell
el 15 de Mzo. de 2015
Editada: Andrew Newell
el 15 de Mzo. de 2015
ismaeel, I think you're barking up the wrong tree. As John D'Errico points out below, the ODE suite accept numeric objects and function handles, not symbolic objects.
As far as I can tell from your description of this problem, what you're really after is a function M = MASS(t,y) for the mass matrix, where t is time and y is the state vector. If I'm wrong, you'll need to add more detail about what you're trying to do and how you're trying to do it.
Jan
el 15 de Mzo. de 2015
When you have expressions like x(1) to x(21), the "x" is a vector already. Therefore I still do not understand what you want to achieve. When Matlab does not match your needs directly, try to use Matlab as it is designed to solve your problem.
Ismaeel
el 15 de Mzo. de 2015
Editada: Andrew Newell
el 15 de Mzo. de 2015
Andrew Newell
el 15 de Mzo. de 2015
So do you want to turn the function output into something like this?
Out = M * x;
And if so, are you wondering how to formulate it as a matrix equation, import M into the function, or both?
Ismaeel
el 15 de Mzo. de 2015
Ismaeel
el 16 de Mzo. de 2015
Andrew Newell
el 16 de Mzo. de 2015
Editada: Andrew Newell
el 16 de Mzo. de 2015
That gives you
x =
x(sqrt(-1))
x(2)
x(3)
x(4)
x(5)
x(6)
x(7)
x(8)
x(9)
x(10)
I don't see how that helps - even if the first entry were x(1).
Andrew Newell
el 16 de Mzo. de 2015
But again, how do you get from there to solving
dx / dt = M(t)*x + b?
Respuesta aceptada
Más respuestas (1)
Categorías
Más información sobre Number Theory en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
