Question

Consider the generic homogeneous spring-mass system my″+γy′+ky=0my″+γy′+ky=0 Use either Euler’s Method or ode45 to investigate how...

Consider the generic homogeneous spring-mass system

my+γy+ky=0my″+γy′+ky=0



Use either Euler’s Method or ode45 to investigate how the solution of the second order
equation
y
00
+ γy0 + 2y = 0
depends on the damping coefficient γ. Include nicely labeled plots y(t) vs. t for each
choice of γ in (a)-(d) below (either on the same or separate axes). Use the initial
conditions y(0) = 0.1, y0(0) = 0 and step size ∆t = 0.001. Write a few sentences
describing how the behavior of y(t) depends on γ and comment on which choice of γ
best matches the behavior we observed in the real live spring-mass system.
(a) γ = 0 (the case of an undamped or harmonic oscillator)
(b) γ = 0.1.
(c) γ = 1.
(d) γ = 3.

Homework Answers

Answer #1


function dummy=ex_with_2eqs()
clc;
clear all;
t0 =0; tf = 4;

x0=0.1;
y0=0;


  
u0 = [x0;y0];% initial condtion
gama=0;
[t,y] = ode45(@f,[t0 tf],u0,[],gama);
u1 = y(:,1);
gama1=0.1;
[t,y1] = ode45(@f,[t0 tf],u0,[],gama1);
u2 = y1(:,1);
gama2=1;
[t,y2] = ode45(@f,[t0 tf],u0,[],gama2);
u3 = y2(:,1);
gama3=3;
[t,y3] = ode45(@f,[t0 tf],u0,[],gama3);
u4 = y3(:,1);



%%% Solution Plot
figure(1);
plot(t,u1,'b');
hold on
plot(t,u2,'r');
hold on
plot(t,u3,'m');
hold on
plot(t,u4,'k');
xlabel('t')
ylabel('y')
legend('\gamma=0','\gamma=0.1','\gamma=1','\gamma=3')


end
%----------------------------------------------------------------------
function dydt = f(t,y,gama)

k=1;
m=1;
  
%%%Here u is y(1), v is y(2),   
u = y(1); v = y(2);
dydt = [v ;-(k/m)*u-(gama/m)*v];
end

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT