# Thread: linear equations in matlab

1. ## 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

2. 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

3. delete

4. 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?

5. 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}$
.

6. 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.

7. Can you post your code then?

8. 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.

9. 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