Ceate a vector of state space variable like A=[x(1), x(2), x(3),.....x(21)]
显示 更早的评论
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 个评论
Andrew Newell
2015-3-15
What vector do you want to create?
Andrew Newell
2015-3-15
编辑:Andrew Newell
2015-3-15
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
2015-3-15
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
2015-3-15
编辑:Andrew Newell
2015-3-15
Andrew Newell
2015-3-15
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
2015-3-15
Ismaeel
2015-3-16
Andrew Newell
2015-3-16
编辑:Andrew Newell
2015-3-16
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
2015-3-16
But again, how do you get from there to solving
dx / dt = M(t)*x + b?
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
