invers matrix error calculate
显示 更早的评论
OA=1.42
AB=4.3
BO=3.33
OO=6
alfa=linspace(19.7, -103, 14);
beta= [37.3648, 40.5764, 43.6511, 46.4267, 48.7411, 50.4573, 51.4816, 51.7706, 51.3269, 50.1884, 48.4165, 46.0853, 43.2749, 40.0669];
gamma= [-68.0355, -66.333, -63.8261, -60.6513, -56.9882, -53.0279, -48.9467, -44.8871, -40.9515, -37.2048, -33.6824, -30.3996, -27.3598, -24.5623]
J=[AB*sind(beta) BO*sind(gamma); AB*cosd(beta) BO*cosd(gamma)]
omega=(inv(J))*[OA*sind(alfa); OA*sind(alfa)]
disp(omega)
It calculates:
OA =
1.4200
AB =
4.3000
BO =
3.3300
OO =
6
gamma =
-68.0355 -66.3330 -63.8261 -60.6513 -56.9882 -53.0279 -48.9467 -44.8871 -40.9515 -37.2048 -33.6824 -30.3996 -27.3598 -24.5623
J =
Columns 1 through 16
2.6096 2.7970 2.9681 3.1153 3.2325 3.3159 3.3644 3.3778 3.3571 3.3031 3.2164 3.0976 2.9476 2.7678 -3.0883 -3.0499
3.4176 3.2660 3.1113 2.9639 2.8357 2.7376 2.6779 2.6609 2.6870 2.7531 2.8540 2.9824 3.1307 3.2908 1.2455 1.3367
Columns 17 through 28
-2.9885 -2.9026 -2.7924 -2.6604 -2.5111 -2.3500 -2.1825 -2.0135 -1.8468 -1.6851 -1.5304 -1.3842
1.4689 1.6321 1.8142 2.0027 2.1870 2.3593 2.5150 2.6523 2.7710 2.8722 2.9575 3.0287
Error using inv
Matrix must be square.
Error in accelerazioniangolari (line 9)
omega=(
How can i solve the error, it calculates J not like 14 matrix, i think that is the problem. How can i fix it?
2 个评论
John D'Errico
2019-2-3
编辑:John D'Errico
2019-2-3
https://www.mathworks.com/matlabcentral/answers/442898-how-to-find-the-inverse-of-a-6-2-matrix
pablolama
2019-2-3
回答(1 个)
John D'Errico
2019-2-3
You cannot use inv on a 2x28 array. So either of these forms are equally valid:
omega=pinv(J)*[OA*sind(alfa); OA*sind(alfa)];
omega=J\[OA*sind(alfa); OA*sind(alfa)];
Neither is more technically coerrect, and you can take your free choice between which of infintely many solutions you want. The two options above are just two of the many possible.
2 个评论
pablolama
2019-2-3
John D'Errico
2019-2-3
You cannot assume that MATLAB will be smart enough to figure out what you want to do, when you try to do something completely unusual. Instead, MATLAB does what you tell it to do, and can do no more than that.
However, nothing stops you from using a loop. Loops are not the worst thing in the world. They are not that inefficient.
doc for
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!