Determinat of Matrix Error cannot take det 'Matrix must be square'
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
%Script
N=numel(Latty);
NED=[ -sind(Latty).*cosd(Lonny) -sind(Latty).*sind(Lonny) cosd(Latty) ;
-sind(Lonny) cosd(Lonny) zeros(N,1) ;
-cosd(Latty).*cosd(Lonny) -cosd(Latty).*sind(Lonny) -sind(Latty) ];
det(NED)
disp(NED)
%Output with det commented out
0.2795 0.5486 0.7880
-0.0220 0.6289 0.7771
0.2254 0.5580 0.7986
-0.1555 0.6237 0.7660
0.2152 0.5914 0.7771
0.1222 0.5749 0.8090
-0.0220 0.6289 0.7771
0.1629 0.6079 0.7771
-0.0215 0.6153 0.7880
-0.1006 0.6349 0.7660
-0.0600 0.5704 0.8192
-0.0733 0.5973 0.7986
0.2890 0.5436 0.7880
-0.1226 0.6310 0.7660
0.0672 0.6393 0.7660
0.2732 0.5362 0.7986
0.1620 0.5650 0.8090
0.0512 0.5855 0.8090
-0.0767 0.6246 0.7771
0.1222 0.5749 0.8090
-0.1336 0.6287 0.7660
-0.0600 0.5704 0.8192
0.0110 0.6292 0.7771
-0.1485 0.5540 0.8192
-0.1629 0.6079 0.7771
0.0329 0.6285 0.7771
0.0798 0.5680 0.8192
0.1489 0.5974 0.7880
0.1945 0.5985 0.7771
-0.0215 0.6153 0.7880
-0.1045 0.5927 0.7986
0.1521 0.5678 0.8090
-0.0400 0.5722 0.8192
0.1760 0.5755 0.7986
0.1735 0.6049 0.7771
-0.1116 0.6330 0.7660
0.2010 0.5523 0.8090
0.0439 0.6278 0.7771
0.1840 0.6018 0.7771
-0.1489 0.5974 0.7880
0.1489 0.5974 0.7880
0.1521 0.5678 0.8090
0.1422 0.5703 0.8090
0.1902 0.5855 0.7880
0.0614 0.5846 0.8090
-0.0308 0.5870 0.8090
0.2795 0.5486 0.7880
0.0500 0.5714 0.8192
0.1336 0.6287 0.7660
-0.0205 0.5874 0.8090
0.0103 0.5877 0.8090
-0.0410 0.5864 0.8090
-0.1021 0.5789 0.8090
0.1959 0.5690 0.7986
0.0963 0.6081 0.7880
-0.1308 0.6156 0.7771
0.1816 0.5590 0.8090
0.2241 0.5280 0.8192
-0.0215 0.6153 0.7880
0.0336 0.6419 0.7660
0.1222 0.5749 0.8090
0.0646 -0.5260 0.8480
0.8910 -0.4540 0
0.9994 0.0349 0
0.9272 -0.3746 0
0.9703 0.2419 0
0.9397 -0.3420 0
0.9781 -0.2079 0
0.9994 0.0349 0
0.9659 -0.2588 0
0.9994 0.0349 0
0.9877 0.1564 0
0.9945 0.1045 0
0.9925 0.1219 0
0.8829 -0.4695 0
0.9816 0.1908 0
0.9945 -0.1045 0
0.8910 -0.4540 0
0.9613 -0.2756 0
0.9962 -0.0872 0
0.9925 0.1219 0
0.9781 -0.2079 0
0.9781 0.2079 0
0.9945 0.1045 0
0.9998 -0.0175 0
0.9659 0.2588 0
0.9659 0.2588 0
0.9986 -0.0523 0
0.9903 -0.1392 0
0.9703 -0.2419 0
0.9511 -0.3090 0
0.9994 0.0349 0
0.9848 0.1736 0
0.9659 -0.2588 0
0.9976 0.0698 0
0.9563 -0.2924 0
0.9613 -0.2756 0
0.9848 0.1736 0
0.9397 -0.3420 0
0.9976 -0.0698 0
0.9563 -0.2924 0
0.9703 0.2419 0
0.9703 -0.2419 0
0.9659 -0.2588 0
0.9703 -0.2419 0
0.9511 -0.3090 0
0.9945 -0.1045 0
0.9986 0.0523 0
0.8910 -0.4540 0
0.9962 -0.0872 0
0.9781 -0.2079 0
0.9994 0.0349 0
0.9998 -0.0175 0
0.9976 0.0698 0
0.9848 0.1736 0
0.9455 -0.3256 0
0.9877 -0.1564 0
0.9781 0.2079 0
0.9511 -0.3090 0
0.9205 -0.3907 0
0.9994 0.0349 0
0.9986 -0.0523 0
0.9781 -0.2079 0
-0.9925 -0.1219 0
0.3577 0.7021 -0.6157
-0.0271 0.7767 -0.6293
0.2992 0.7405 -0.6018
-0.1853 0.7433 -0.6428
0.2658 0.7303 -0.6293
0.1682 0.7913 -0.5878
-0.0271 0.7767 -0.6293
0.2011 0.7507 -0.6293
-0.0275 0.7875 -0.6157
-0.1198 0.7566 -0.6428
-0.0856 0.8147 -0.5736
-0.0973 0.7927 -0.6018
0.3699 0.6958 -0.6157
-0.1462 0.7520 -0.6428
0.0801 0.7618 -0.6428
0.3626 0.7116 -0.6018
0.2230 0.7777 -0.5878
0.0705 0.8059 -0.5878
-0.0947 0.7714 -0.6293
0.1682 0.7913 -0.5878
-0.1593 0.7493 -0.6428
-0.0856 0.8147 -0.5736
0.0136 0.7770 -0.6293
-0.2120 0.7912 -0.5736
-0.2011 0.7507 -0.6293
0.0407 0.7761 -0.6293
0.1140 0.8112 -0.5736
0.1906 0.7646 -0.6157
0.2402 0.7391 -0.6293
-0.0275 0.7875 -0.6157
-0.1387 0.7865 -0.6018
0.2094 0.7815 -0.5878
-0.0571 0.8172 -0.5736
0.2335 0.7637 -0.6018
0.2142 0.7470 -0.6293
-0.1330 0.7544 -0.6428
0.2767 0.7602 -0.5878
0.0542 0.7753 -0.6293
0.2272 0.7432 -0.6293
-0.1906 0.7646 -0.6157
0.1906 0.7646 -0.6157
0.2094 0.7815 -0.5878
0.1957 0.7850 -0.5878
0.2435 0.7494 -0.6157
0.0846 0.8046 -0.5878
-0.0423 0.8079 -0.5878
0.3577 0.7021 -0.6157
0.0714 0.8160 -0.5736
0.1593 0.7493 -0.6428
-0.0282 0.8085 -0.5878
0.0141 0.8089 -0.5878
-0.0564 0.8070 -0.5878
-0.1405 0.7967 -0.5878
0.2600 0.7551 -0.6018
0.1233 0.7783 -0.6157
-0.1616 0.7602 -0.6293
0.2500 0.7694 -0.5878
0.3201 0.7540 -0.5736
-0.0275 0.7875 -0.6157
0.0401 0.7650 -0.6428
0.1682 0.7913 -0.5878
0.1034 -0.8417 -0.5299
%Error with det active
Error using det
Matrix must be square.
%Latty and Lonny are 62x1 doubles
2 commentaires
Matt J
le 5 Sep 2023
The error message seems self-explanatory. The disp() output clearly shows that your matrix is not square. Please explain what is unclear.
Dyuman Joshi
le 5 Sep 2023
The error could not be more clear.
Do you have a way of defining determinant for non-square matrices?
Réponses (1)
Torsten
le 5 Sep 2023
Déplacé(e) : Torsten
le 5 Sep 2023
Latty = [
38
39
37
40
39
36
39
39
38
40
35
37
38
40
40
37
36
36
39
36
40
35
39
35
39
39
35
38
39
38
37
36
35
37
39
40
36
39
39
38
38
36
36
38
36
36
38
35
40
36
36
36
36
37
38
39
36
35
38
40
36
32];
Lonny = [
-117
-88
-112
-76
-110
-102
-88
-105
-88
-81
-84
-83
-118
-79
-96
-117
-106
-95
-83
-102
-78
-84
-91
-75
-75
-93
-98
-104
-108
-88
-80
-105
-86
-107
-106
-80
-110
-94
-107
-76
-104
-105
-104
-108
-96
-87
-117
-95
-102
-88
-91
-86
-80
-109
-99
-78
-108
-113
-88
-93
-102
0];
NED = arrayfun(@(Latty,Lonny)[ -sind(Latty).*cosd(Lonny) -sind(Latty).*sind(Lonny) cosd(Latty) ; -sind(Lonny) cosd(Lonny) 0 ; -cosd(Latty).*cosd(Lonny) -cosd(Latty).*sind(Lonny) -sind(Latty) ],Latty,Lonny,'UniformOutput',0);
detNED = arrayfun(@(i)det(NED{i}),1:numel(Latty))
0 commentaires
Voir également
Catégories
En savoir plus sur Linear Algebra dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!