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!
