(3.6) cos(0)+(3.4) cos(100)+(3.16) cos(θ3)+(2.8) cos(θ4)=0 (3.6) sin(0)+(3.4) sin(100)+(3.16) sin(θ3)+(2.8) sin(θ4)=0 please solve for the unknowns (θ3) and (θ4) in matlab

We can solve these two linear equations using the matrix form Ax = b, where A contains coefficients of unknowns, x contains unknowns itself, and b contains constant terms. Here,

main.m
A = [3.16 2.8; 3.4 3.6]
x = [cos3); cos4)]
b = [-3.6*cos(0) - 3.4*cos(100); -3.6*sin(0) - 3.4*sin(100)]
108 chars
4 lines

In MATLAB, we can solve it using the linsolve function:

main.m
x = linsolve(A,b)
18 chars
2 lines

This will give us the values of cos(θ3) and cos(θ4). To get the values of θ3 and θ4, we will use the acos function:

main.m
theta = acos(x) * 180 / pi
27 chars
2 lines

The acos function returns the angle in radians, so we convert it to degrees by multiplying with 180/pi.

Note that there might be multiple solutions to this problem, so it's a good idea to check if the values we get satisfy the original equations.

related categories

gistlibby LogSnag