# linear equations in matlab

• Dec 5th 2009, 07:10 AM
saha01
linear equations in matlab
Consider a point body of mass hung from a ceiling on two ropes which form the angles α and β to the horizontal. Tension forces and in the ropes are then determined by the solution of the following system of linear equations

-T1 cos 30 + T2 cos 45 = 0

T1 sin 30+ T2 sin 45 = mg

where g=9.80665ms-2 is the acceleration due to gravity

Write a script M-file which computes the tension forces T1and T2when m=20kg and alpha=30 and beta=45 degrees

ive been told to represent this system in matrix form, but im not sure how to.....

can anyone help?

thanks

• Dec 5th 2009, 03:33 PM
CaptainBlack
Quote:

Originally Posted by saha01
Consider a point body of mass hung from a ceiling on two ropes which form the angles α and β to the horizontal. Tension forces and in the ropes are then determined by the solution of the following system of linear equations

-T1 cos 30 + T2 cos 45 = 0

T1 sin 30+ T2 sin 45 = mg

where g=9.80665ms-2 is the acceleration due to gravity

Write a script M-file which computes the tension forces T1and T2when m=20kg and alpha=30 and beta=45 degrees

ive been told to represent this system in matrix form, but im not sure how to.....

can anyone help?

thanks

$\left[
\begin{array}{rr}
-\cos(30) & \cos(45)\\
\sin(30) & \sin(45)
\end{array}\right]
\left[ \begin{array}{c}T_1\\T_2\end{array}\right]=
\left[ \begin{array}{c}0\\mg\end{array} \right]
$

CB
• Dec 5th 2009, 04:43 PM
lvleph
delete
• Dec 7th 2009, 10:58 AM
saha01
Quote:

Originally Posted by CaptainBlack
$\left[
\begin{array}{rr}
-\cos(30) & \cos(45)\\
\sin(30) & \sin(45)
\end{array}\right]
\left[ \begin{array}{c}T_1\\T_2\end{array}\right]=
\left[ \begin{array}{c}0\\mg\end{array} \right]
$

CB

i cant seem to insert [ t1 and t2] into matlab, it says undefined function, how should i change this?
• Dec 7th 2009, 11:09 AM
lvleph
You are solving for $\begin{pmatrix}T_1\\T_2\end{pmatrix}$, so you write
$T = A \setminus b$
where $A = \begin{pmatrix}-\cos(30) & \cos(45)\\
\sin(30) & \sin(45)\end{pmatrix}, \quad b = \begin{pmatrix} 0 \\ mg\end{pmatrix}$
.
• Dec 7th 2009, 11:13 AM
saha01
Quote:

Originally Posted by lvleph
You are solving for $\begin{pmatrix}T_1\\T_2\end{pmatrix}$, so you write
$T = A \setminus b$
where $A = \begin{pmatrix}-\cos(30) & \cos(45)\\
\sin(30) & \sin(45)\end{pmatrix}, \quad b = \begin{pmatrix} 0 \\ mg\end{pmatrix}$
.

yes i know that, but the problem im having is that when i type into matlab [ T1 T2], it says T is an undefined function or variable.
• Dec 7th 2009, 11:17 AM
lvleph
Can you post your code then?
• Dec 7th 2009, 11:19 AM
saha01
Quote:

Originally Posted by lvleph
Can you post your code then?

T=A\b

A=[-cos(30) cos(45)
sin(30) sin(45)]

m=20
g=9.80665

b=[0 m*g]

when i type this in i get

??? Error using ==> mldivide
Matrix dimensions must agree.

• Dec 7th 2009, 11:32 AM
lvleph
Your code should be in this order
Code:

A=[-cos(30) cos(45) sin(30) sin(45)] m=20 g=9.80665 b=[0 m*g] T=A\b