Clear Filters
Clear Filters

Solving a 9x9 matrix in which all values are a 1x361 matrix

6 views (last 30 days)
I am trying to solve an analysis problem in which every equation is a function of theta (for a full 360 degrees). In order to finish the analysis, I must run a 9x9 matrix. In doing so, I end up with a 9x9 matrix who's values are a 1x361 matrix (1 value for each degree of theta). When solving AX=B, the B matrix is a 9x1. Using the '\' operator, the resultant matrix 'X' ends up being a 3,249x361 matrix. From the workspace: A = 9x3249, B = 9x361
This is a force analysis problem. The velocity and acceleration numbers/graphs are accurate, but the forces do not appear to be correct, nor can I index them out. It is desired for X to be a 9x361 matrix. I am relatively new to matlab so any help is greatly appreciated. I can post my code up if necessary, it is just very long.
Thank you

Answers (1)

Nitin Khola
Nitin Khola on 4 Aug 2015
I understand that you are trying to solve a system of linear equations for every angle using the backslash operator. I am assuming that the unknowns are velocity, acceleration and force in the three dimensions for each angle.
A possibly better approach in this case is to first use three dimensional arrays A, B and X to store the values. Then, solve (A_theta)*(X_theta)=B_theta, where A_theta=9x9, X_theta=9x1 and B_theta=9x1, for every angle theta using a 'for' loop.
Using this approach the unknown vector x can be determined for each angle. For example, take a simple case (for three values of theta) of A(2x2x3), B(2x1x3) and X(2x1x3), the for loop would look like,
>> for ind = 1:3
x(:,:,ind) = A(:,:,ind)\B(:,:,ind);
In your specific case, the matrices can have dimensions of A(9x9x361), B(9x1x361) and x(9x1x361). Using a for loop simplifies indexing of values in your case.
However, if you are trying to do something else, provide more details about the modeling approach and the physical interpretation of A, B and X.


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!