0% found this document useful (0 votes)
27 views6 pages

MATLAB Lab Session 04 (Solutions)

The document contains a series of MATLAB problems related to force calculations, moments, and center of mass. Each problem is solved manually with corresponding MATLAB code snippets to compute resultant forces, magnitudes, angles, and currents using Kirchhoff's laws. The problems cover various concepts in mechanics and electrical circuits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views6 pages

MATLAB Lab Session 04 (Solutions)

The document contains a series of MATLAB problems related to force calculations, moments, and center of mass. Each problem is solved manually with corresponding MATLAB code snippets to compute resultant forces, magnitudes, angles, and currents using Kirchhoff's laws. The problems cover various concepts in mechanics and electrical circuits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB SESSION - 04

REVIEW PROBLEM-01
(Solved Manually)

ouse
hie M
ec
@M
(In MATLAB)

% REVIEW PROBLEM 1
F1=600*[cosd(36.87), 0, sind(36.87)]
F2=400*[cosd(60), cosd(45), cosd(120)]

FR=F1+F2 % Resultant Force


FR_magnitude= norm(FR)

Page 1 of 6
REVIEW PROBLEM-02
(Solved Manually)

ouse
hie M
ec (In MATLAB)

@M
% REVIEW PROBLEM 2
% Given force components of F1 & FR
FR=[-300 650 250];
F1=[750*cosd(30)*cosd(45) 750*sind(30)*cosd(45) -750*sind(45)];

% For "F"
F=FR-F1

% For magnitude of "F"


F_magnitude=norm(F)

% Compute angles
alpha=acosd(F(1)/F_magnitude)
beta=acosd(F(2)/F_magnitude)
gamma=acosd(F(3)/F_magnitude)

Page 2 of 6
REVIEW PROBLEM-03

ouse
hie M
ec
@M
% REVIEW PROBLEM 3
F=[-120,-90,-80]; % Force vector in lb
L=34; % Length of cable in ft

F_magnitude=norm(F) % Calculating magnitude of Force vector

u=F/F_magnitude % Unit vector of the force

% Proportions of x, y, & z from the unit vector


x=-1*L*u(1)
y=-1*L*u(2)
z=-1*L*u(3)

Page 3 of 6
REVIEW PROBLEM-04
(Solved Manually)

ouse
hie M
ec
@M
(In MATLAB)

% REVIEW PROBLEM 4
r_OA=[3,3,-2]; % Position vector in ft
F1=[-20,10,30]; % Force vector in lb

% Calculate the moment using cross product


M_O=cross(r_OA,F1)

% Calculate the magnitude of the moment


M_magnitude=norm(M_O)

Page 4 of 6
REVIEW PROBLEM-05

ouse
hie M
% REVIEW PROBLEM 5

ec
% P is a matrix with 6 rows & 4 columns

@M
% Columns:[mass, x, y, z coordinates]
P=[0.5 -10 8 32; 0.8 -18 6 19; 0.2 -7 11 2; 1.1 5 12 -9; 0.4 0 -8 -6; 0.9 25 -20 8];

mass=sum(P(:,1))

x=sum(P(:,1).*P(:,2))/mass
y=sum(P(:,1).*P(:,3))/mass
z=sum(P(:,1).*P(:,4))/mass

% REVIEW PROBLEM 5 (Another method)


% Given data
masses=[0.5,0.8,0.2,1.1,0.4,0.9];
x_coords=[-10,-18,-7,5,0,25];
y_coords=[8,6,11,12,-8,-20];
z_coords=[32,19,2,-9,-6,8];

total_mass=sum(masses)

% Center of mass calculations


x_center=sum(masses.*x_coords)/total_mass
y_center=sum(masses.*y_coords)/total_mass
z_center=sum(masses.*z_coords)/total_mass

Page 5 of 6
REVIEW PROBLEM-06

ouse
hi M
% REVIEW PROBLEM 6

e
% Given & assuming the missing values

ec
R1=20; R2=12; R3=8; R4=6; R5=10; R6=4; R7=8; R8=20;

@M
V1=12; V2=24; V3=45;

% Kirchhoff's Voltage Law equations in matrix form


A=[(R1+R2) 0 -R2 zeros(1,3);
0 R3 0 -R3 zeros(1,2);
-R2 0 (R2+R4) zeros(1,3);
0 -R3 0 (R3+R5+R7) -R5 -R7;
zeros(1,3) -R5 (R5+R6) 0;
zeros(1,3) -R7 0 (R7+R8)]

% Voltage sources
B=[0;-V1;-V2;V2;V3;-V3]

% Solve for currents


I=A\B
i1=I(1,1)
i2=I(2,1)
i3=I(3,1)
i4=I(4,1)
i5=I(5,1)
i6=I(6,1)

Page 6 of 6

You might also like