**Task 2 was completed. (Attached is my code for Task 2) I\'m struggling to comp
ID: 3756707 • Letter: #
Question
**Task 2 was completed. (Attached is my code for Task 2) I'm struggling to complete the code for Task 3. I have attached data file that is required for task 3.**
Task 2: Develop a computing program (using Matlab) to calculate the reaction force (Weeks 4 - 6). The program must be able to: Accept inputs from a data file (such as an excel sheet, which contains the required input). Inputs include beam length, location of supports and the load(s) and their corresponding locations (x measured from the reference point ‘0’ as shown in Figure 3). The program must be able to accept multiple arbitrary point and distributed loads placed at different locations as vectors. Calculate and output the resulting reactions at each support for point load and distributed load cases.
Task 3: Extending the program (Weeks 4-11) Write Matlab program to calculate the shear and internal moments in the beam as a result of the external forces exerted on the beam. Output the results in figures to show the shear and moment diagrams Label the maximum points (maximum shear value and location, maximum bending moment value and location)
%%%% Code for Task 2%%%%
%% Assignment Task 2
%% POINT LOADS: CASE 1-5
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 1-5.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Froce 2 applied (N)
xf1= data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
Lbeam = 65; % Total length of the beam (cm)
Lr = 50; % Distance between the two scales (cm)
n1=length(xf1);
n2=length(xf2);
%Calculate Reaction 2
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
%% POINT LOADS: CASE 7-9
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 7-9.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Froce 2 applied (N)
xf1= data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
Lbeam = 65; % Total length of the beam (cm)
Lr = 50; % Distance between the two scales (cm)
n1=length(xf1);
n2=length(xf2);
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
table_2=[R1:R2]
end
%% POINT LOADS - CASE 6
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 6.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Froce 2 applied (N)
xf1= data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
Lbeam = 65; % Total length of the beam (cm)
Lr = 50; % Distance between the two scales (cm)
n1=length(xf1);
n2=length(xf2);
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
table_3=[R1,R2];
%% POINT LOADS: CASE 10
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 10.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Froce 2 applied (N)
xf1= data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
Lbeam = 65; % Total length of the beam (cm)
Lr = 50; % Distance between the two scales (cm)
n1=length(xf1);
n2=length(xf2);
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
table_4=[R1,R2];
%% DISTRIBUTED LOADS: CASE 11
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 11.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Froce 2 applied (N)
xf1= data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
Lbeam = 65; % Total length of the beam (cm)
Lr = 50; % Distance between the two scales (cm)
n1=length(xf1);
n2=length(xf2);
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
table_5=[R1,R2];
%% DISTRIBUTED LOADS: CASE 12
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 12.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Force 2 applied (N)
f3=data(:,8); % Force 3 applied (N)
xf1=data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
xf3=data(:,9); % Location of the applied force 3 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
L3=data(:,10); % Length of the external force 3 (cm)
Lbeam=65; % Total length of the beam (cm)
Lr=50; % Distance between the two scales (cm)
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
table_6=[R1,R2];
%% DISTRIBUTED LOADS: CASE 13
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 13.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Force 2 applied (N)
f3=data(:,8); % Force 3 applied (N)
xf1=data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
xf3=data(:,9); % Location of the applied force 3 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
L3=data(:,10); % Length of the external force 3 (cm)
Lbeam=65; % Total length of the beam (cm)
Lr=50; % Distance between the two scales (cm)
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
end
table_7=[R1,R2];
%% DISTRIBUTED LOADS: CASE 14
clc;
clear;
close all;
%Load measured data
data = xlsread('Case 14.xlsx');
%Extract forces, lengths and locations.
f1=data(:,2); % Force 1 applied (N)
f2=data(:,5); % Force 2 applied (N)
f3=data(:,8); % Force 3 applied (N)
xf1=data(:,3); % Location of the applied force 1 (cm)
xf2=data(:,6); % Location of the applied force 2 (cm)
xf3=data(:,9); % Location of the applied force 3 (cm)
L1=data(:,4); % Length of the external force 1 (cm)
L2=data(:,7); % Length of the external force 2 (cm)
L3=data(:,10); % Length of the external force 3 (cm)
Lbeam=65; % Total length of the beam (cm)
Lr=50; % Distance between the two scales (cm)
for i = 1:length(xf1);
%Reset Sum
R2=0;
R1=0;
for ii=1:length(xf2);
R2 = (1/(2*Lr))*(((2*xf1(i)+L1(i))*f1(i))+((2*xf2(ii)+L2(ii))*f2(ii)));
fprintf('The reaction at the roller support is %1.2f N ',R2)
%disp(R2)
end
R1=R1+((f1+f2)-R2);
fprintf('The reaction at the hinge support is %1.2f N ',R1)
%disp(R1)
table_8=[R1,R2]
end
%%%% Data Files
Case No. F1 Location (L1)(cm) Length (x1) F2 Location 2 (L2) Length 2 (x2) R1 R2 Conversion Factor (kg) Gravity (m/s^2) 1 2.943 0 0 0 0 0 2.94 0 1000 9.81 2 2.943 10 0 0 0 0 2.35 0.59 3 2.943 20 0 0 0 0 1.77 1.18 4 2.943 30 0 0 0 0 1.18 1.77 5 2.943 40 0 0 0 0 0.59 2.35 6 2.943 50 0 0 0 0 0 2.94 7 2.943 0 0 0 0 0 2.94 0 8 2.943 10 0 0 0 0 2.35 0.59 9 2.943 20 0 0 0 0 1.77 1.18 10 5.886 25 0 2.943 50 0 2.94 5.89 11 20.042 10 30 0 0 0 10.02 10.02 12 6.681 55 10 0 0 0 -1.34 8.02 13 13.361 15 20 6.681 55 10 5.34 14.7 14 13.361 15 20 2.943 55 0 6.39 9.92Explanation / Answer
evaluateReaction
Evaluate reaction forces on boundary
collapse all in page
Syntax
F = evaluateReaction(structuralresults,RegionType,RegionID)
Description
example
F = evaluateReaction(structuralresults,RegionType,RegionID) evaluates reaction forces on the boundary specified by RegionType and RegionID. The function uses the global Cartesian coordinate system. For a dynamic structural model, evaluateReaction evaluates reaction forces for all time-steps.
Examples
collapse all
Reaction Forces on Restrained End of Prismatic Bar
Try This Example
Create a static structural model.
Create a cuboid geometry and include it in the model. Plot the geometry.
Specify the Young's modulus and Poisson's ratio.
Fix one end of the bar and apply pressure to the opposite end.
Generate a mesh and solve the problem.
Compute the reaction forces on the fixed end.
Reaction Forces for 3-D Structural Dynamic Problem
Try This Example
Evaluate the reaction forces at the fixed end of a beam subject to harmonic excitation.
Create a transient dynamic model for a 3-D problem.
Create a geometry and include it in the model. Plot the geometry.
Specify the Young's modulus, Poisson's ratio, and mass density of the material.
Fix one end of the beam.
Apply a sinusoidal displacement along the y-direction on the end opposite the fixed end of the beam.
Generate a mesh.
Specify the zero initial displacement and velocity.
Solve the model.
Compute the reaction forces on the fixed end.
Input Arguments
structuralresults — Solution of structural analysis problem
StaticStructuralResults object | TransientStructuralResults object
Solution of the structural analysis problem, specified as a StaticStructuralResults or TransientStructuralResults object. Create structuralresults by using the solve function.
Example: structuralresults = solve(structuralmodel)
RegionType — Geometric region type
'Edge' for a 2-D model | 'Face' for a 3-D model
Geometric region type, specified as 'Edge' for a 2-D model or 'Face' for a 3-D model.
Example: evaluateReaction(structuralresults,'Face',2)
Data Types: char | string
RegionID — Geometric region ID
vector of positive integers
Geometric region ID, specified as a vector of positive integers. Find the region IDs using pdegplot, as shown in Create Geometry and Remove Face Boundaries or STL File Import.
Example: evaluateReaction(structuralresults,'Face',2)
Data Types: double
Output Arguments
collapse all
F — Reaction forces
structure array
Reaction forces, returned as a structure array. The array fields represent the integrated reaction forces and surface traction vector, which are computed by using the state of stress on the boundary and the outward normal.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.