Question: Problem 3 . 3 prob 3 _ 4 . mlx set up W } = 3 5 ; quad % mathrm { weight

Problem 3.3 prob3_4.mlx
set up
W}=35;\quad%\mathrm{ weight [lb]
g =32.2*12; % Gravitational acceleration [in/s^2]
m}=\textrm{w}/\textrm{g};\quad%\mathrm{ Mass [lb*s^2/in]
k =6.8; % stiffness [lb/in]
x0=-2; % Initial position [in]
dxe =6; % Initial velocity [in/s]
Find the response analytically
wn = sqrt (k/m);
A}=\operatorname{sqrt(x0}2)
tA = linspace(0,3);
Find the response numerically
[tN,zN]= ode45(@trafficLightEOM, [03],[x0,dx0]);
Plot
figure
hold on
plot(tA,xA, 'DisplayName', 'Analytical')
plot(tN,zN,':', 'LineWidth',3, 'DisplayName','Numerical')
legend('show')
xlabel('Time (s)')
ylabel('x (in)') prob3_4.mlx x trafficLightEOM.m
function dz = trafficLightEOM(t,z)
% First-order differential equation for an undamped free system to be used
% with ode45.
% Inputs:
% ~ t: the time, a single value
% ~ z: a vector of position and velocity. The first element is position and
% the second is velocity.
% Outputs:
% ~ dz: the derivative of z
%% Set up
W=35; % Weight [lb]
g =32.2*12; % Gravitational acceleration [in/s^2]
m}=\textrm{W}/\textrm{g};\quad%\mathrm{ Mass [lb*s^2/in]
k =6.8; % Stiffness [lb/in]
%% Equations of motion
z1= z(1); %position
z2=z(2); %velocity
dz =[z2;-k/m*z1]
Just after a gust of wind, a 35 lb traffic light has a position of -2 in and a velocity of 6ins relative to its
rest position. Suppose the equivalent stiffness is 6.8lbin.
a) Find the response of the system analytically.
b) Suppose a student were to calculate the phase shift using their calculator. Explain why they
should or should not add to the value from the calculator.
Partial answer: a)x=(2.12in)sin(8.66t-1.24)
Problem 3.4
Download the files prob3_4.mlx and trafficLightEOM.m from Canvas. These files will be used to find the
response of the system in Problem 3.3 numerically (i.e., using ode45).
a) There are several errors in the files. Find and fix all the errors. Also briefly explain why the error
is an error (as if you were explaining it to your friend). Circle, highlight, or otherwise clearly
indicate where you modified the code.
b) Plot of the position of the traffic light with respect to time for both the analytical and numerical
responses. Does your plot seem correct? Why or why not?
Hint 1: When you download the files, make sure you can see them in the Current Folder window in Matlab.
If you cannot, either move the files to your current folder or change the working folder. See the third video
in Module 3E for additional details.
Hint 2: For all problems that involve Matlab, submit the code you used/wrote as well as the output. You
can export .mlx files as a PDF. You can print m files as a PDF.
Partial answer: b)
ONLY NEED 3.4 COMPLETED. 3.3 CONTAINS BACKGROUND INFORMATION AND NUMBERS RELEVANT TO 3.4
Problem 3 . 3 prob 3 _ 4 . mlx set up W } = 3 5 ;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!