MATLAB: How to add iterations to a matrix as values in a loop and get the inverse of the matrix

matrixmatrix manipulation

hello
iam making a force analysis program the prog first takes some data from the user and then gets the unknown forces through 2 matrices V=a\b where a is the coeff matrix and b is the constant matrix the problem is the user is asked to enter 1 value of theta and it works fine give the forces at this theta but when i insert theta as th2=0:1:360 give a CAT arguments dimensions are not consistent.error i want to get the forces and get the corresponding theta and then plot them ….. any help would be great thnx in advance

Best Answer

There is something you left out. Because this does not error:
th2 = 0:1:360;
As it is a simple assignment. Post the actual line that error-ed and the entire error message.
EDIT In response to your comments and code. %
%
%
You are doing something you probably do not want to do. You are using the handles to uicontrol objects as the user-entered values in those objects. For example,
e=handles.edit8;
...
th3=asin(((e)+(l2)*(sin(th2r)))/(l3));
The first line should probably read:
e = str2double(get(handles.edit8,'string'));
Secondly, the error comes because you are trying to put together a matrix A which has some rows with 8 columns and others with several hundred columns.
th2=[1:360];
...
th3=asin(((e)+(l2)*(sin(th2r)))/(l3));
Now look at your assignment to A. Row tow has 8 columns and row 5 has 1144 columns. That won't work. A matrix has the same number of rows per columns and columns per row.
There may be other errors but that is enough to show that the code needs to be gone through carefully from line 1 at this point.