4)Physically, damping is always present. Now equation 2 below is modified for damping.
x''+2x'+16x=3sin(t) (2),
Solve in Mathematica or Matlab and plot the solutions for the following conditions.
Using different styles and line color. Plot (a) and (b) on the same graph then (c) and (d) on another.
= 8 x(0) = x’(0) = 0
= 4 x(0) = x’(0) = 0
= 4 x(0) = 0, x’(0) = 5
= 4 x(0) = 1, x’(0) = 0
To be able to work with this equation, it was converted to a system of first order equations.
u1'=u2
u2'= -16u1-2u2+3sin(t)
%%% Matlab code
clc;
close all;
clear all;
format long
%%% 2nd order ordinary DE
%% let x=x(1)=x, x'=y=x(2)
f=@(t,x) [ x(2); 3*sin(t)-2*x(2)-16*x(1)];
tspn=[0 10]; %%% Time span
x0=[0 0]; %%% initial conditions
tol=10^(-6);
[t,xa]=ode45(f,tspn,x0,tol);
x0=[4 0]; %%% initial conditions
tol=10^(-6);
[t1,xb]=ode45(f,tspn,x0,tol);
figure;
plot(t,xa(:,1));
hold on
plot(t1,xb(:,1));
xlabel('t');
ylabel('x');
legend('a','b');
grid on
x0=[0 5]; %%% initial conditions
tol=10^(-6);
[t3,xc]=ode45(f,tspn,x0,tol);
x0=[1 0]; %%% initial conditions
tol=10^(-6);
[t4,xd]=ode45(f,tspn,x0,tol);
figure;
plot(t3,xc(:,1));
hold on
plot(t4,xd(:,1));
xlabel('t');
ylabel('x');
legend('c','d');
grid on
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.