How can I fix this error?

4 次查看(过去 30 天)
Emily Gobreski
Emily Gobreski 2016-6-12
theta=30
sign=(cosd (theta)/abs (cosd (theta)))
u=.8
R=12
c=5
y=8
Id=(.5*Md*R^2)
Mp=75
Mb=30
alpha=0
u=.8
L=6*R
a=[1 0 1 0 0 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0 0 0; 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0 0 1; 0 0 0 0 1 0 1 0 0 0 0; 0 0 0 0 0 1 0 1 0 0 0; 0 0 0 0 (-R*sind (theta)) (R*cosd (theta)) 0 0 0 0 0; 0 0 -1 0 -1 0 0 0 (4*abs (sign)) 0 0; 0 0 0 -1 0 -1 0 0 (-4*u*sign) 0 0; 0 0 -c (3*R) -c (-3*R) 0 0 (-4*(y-c)) 0 0; 0 0 0 0 0 0 0 0 (-u*sign) 1 0]
c=[0; Md*g; Id*alpha; 0; Md*g; Id*alpha; Mp*ax; Mp*y; 0; Mb*ab; Mb*g]
x=c/inv(a)
Trial>> x=c/inv(a)
Error using inv
Matrix must be square.
  2 个评论
John D'Errico
John D'Errico 2016-6-12
Writing c/inv(a) is wrong for several reasons, sufficiently so that I have no idea what you really want to solve. To start with,
- Md is undefined
- a is not square, so you cannot form the inverse matrix
- Since / will factor the matrix inv(a) and THEN try to do something similar to taking an inverse, you are essentially trying to form the inverse of the inverse of a.
I think you need to think about what you are trying to do. At least, explain it, because your code makes no sense.
Emily Gobreski
Emily Gobreski 2016-6-12
Matrix [a][x]=[c]
I am trying to solve for the unknown matrix x.
Mb should be Md

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2016-6-12
编辑:John D'Errico 2016-6-12
So x is a VECTOR, not a matrix.
You need to understand there will NOT be a unique solution. The matrix a is 10 by 11, so the problem is under-determined. There are infinitely many solutions to such a problem.
You can solve the problem A*x=c, for unknown vector x a:
x = a\c;
This will generate ONE solution, that has the property that at least one of the unknown elements in x will be zero.
Alternatively, you can use
x = pinv(a)*c;
This solution will have the property that it will have a minimum norm among all possible solutions.
And of course, you need to consider if there should be another row in the matrix a (and one more element in c). Such an under-determined problem may indicate that your problem is not formulated properly as written.

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by