Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 7: Modify your Matlab code in Problem 5 to include input F(t). Simulate the system with these conditions: Initial conditions for stretch and velocity

image text in transcribedimage text in transcribed

Problem 7: Modify your Matlab code in Problem 5 to include input F(t). Simulate the system with these conditions: Initial conditions for stretch and velocity are both 0. a. The force input is: F(t) = 1 + sin(2pi*t) b. The force input is: F(t) = cos(3pi*t) C. The force input is: F(t) = 2 (1 + sin(2pi*t)) + 3 cos(3pi*t) Plot the results for all 3 cases. Comment on how the results in case c. is related to results in cases a. and b.? [Hint:} How does it relate to "superposition" as discussed in lecture 2? Matlab code: % Sping- damper mass system clear all; cle; m = 1; % mass in kg b = 0.5 % damping constant in N/(m/s) k = 4 % sping constant in N/m Tfinal = 20; % final time in second dt = 0.1; % time step N = round(Tfinal/dt); % no. of time steps % initial condition x(1) = 1; % initial displacement x(2) = 1; % obtain from initial velocity is zero v(1) = 0; % initial velocity t(1) = 0; t(2) = dt; % coefficient A = (1/(dt*dt))+b/(m*dt); C = (2/(dt*dt))+b/(m*dt)-k/m; D = -1/(dt*dt); for i = 2: N x(i+1) = ( C*x(i) + D*x(i-1) )/A; t(i+1) = i*dt; v(i) = (x(i+1) - XO)/dt; end V(N+1) = V(N); subplot(2,1,1) plot(t,x,r,'Linewidth, 2) xlabel('Time(s)) ylabel('Displacement (m)) subplot(2,1,2) plot(t,v,'g'Linewidth, 2) xlabel('Time(s)) ylabel("Velocity (m/s)') Problem 7: Modify your Matlab code in Problem 5 to include input F(t). Simulate the system with these conditions: Initial conditions for stretch and velocity are both 0. a. The force input is: F(t) = 1 + sin(2pi*t) b. The force input is: F(t) = cos(3pi*t) C. The force input is: F(t) = 2 (1 + sin(2pi*t)) + 3 cos(3pi*t) Plot the results for all 3 cases. Comment on how the results in case c. is related to results in cases a. and b.? [Hint:} How does it relate to "superposition" as discussed in lecture 2? Matlab code: % Sping- damper mass system clear all; cle; m = 1; % mass in kg b = 0.5 % damping constant in N/(m/s) k = 4 % sping constant in N/m Tfinal = 20; % final time in second dt = 0.1; % time step N = round(Tfinal/dt); % no. of time steps % initial condition x(1) = 1; % initial displacement x(2) = 1; % obtain from initial velocity is zero v(1) = 0; % initial velocity t(1) = 0; t(2) = dt; % coefficient A = (1/(dt*dt))+b/(m*dt); C = (2/(dt*dt))+b/(m*dt)-k/m; D = -1/(dt*dt); for i = 2: N x(i+1) = ( C*x(i) + D*x(i-1) )/A; t(i+1) = i*dt; v(i) = (x(i+1) - XO)/dt; end V(N+1) = V(N); subplot(2,1,1) plot(t,x,r,'Linewidth, 2) xlabel('Time(s)) ylabel('Displacement (m)) subplot(2,1,2) plot(t,v,'g'Linewidth, 2) xlabel('Time(s)) ylabel("Velocity (m/s)')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions