Horzcat Error in 3x3 matrix with multiplication of Matrices
Show older comments
I am attempting to write this 3x3 matrix :
NED=[ -sin(Latty).*cos(Lonny) -sin(Latty).*sin(Lonny) cos(Latty) ; -sin(Lonny) cos(Lonny) 0 ; -cos(Latty).*cos(Lonny) -cos(Latty).*sin(Lonny) -sin(Latty) ];
I am recieving this error
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in xlxstomat (line 87)
NED=[ -sin(Latty).*cos(Lonny) -sin(Latty).*sin(Lonny) cos(Latty) ; -sin(Lonny) cos(Lonny) 0 ; -cos(Latty).*cos(Lonny) -cos(Latty).*sin(Lonny) -sin(Latty) ];
2 Comments
Works for me:
Latty = pi/6;
Lonny = pi/4;
NED=[ -sin(Latty).*cos(Lonny) -sin(Latty).*sin(Lonny) cos(Latty) ; -sin(Lonny) cos(Lonny) 0 ; -cos(Latty).*cos(Lonny) -cos(Latty).*sin(Lonny) -sin(Latty) ]
olivia
on 31 Aug 2023
Accepted Answer
More Answers (1)
There is nothing inherently wrong with the matrix you specified (as you can see from the code below).
You'll need to share more information. Can you upload a code snippet and data that will allow us to run the code and reproduce the error? (You can use the paper clip icon in the INSERT section of the toolbar to attach files.)
Please don't just share a description of what is going on.
Latty = pi/3;
Lonny = pi/7;
NED=[ -sin(Latty).*cos(Lonny) -sin(Latty).*sin(Lonny) cos(Latty) ;
-sin(Lonny) cos(Lonny) 0 ;
-cos(Latty).*cos(Lonny) -cos(Latty).*sin(Lonny) -sin(Latty)]
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!