Problem Set E

# Problem Set E - Joey Hartstein Kelley Heffner Problem Set E...

This preview shows pages 1–5. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Joey Hartstein, Kelley Heffner Problem Set E a) This is the code for solving and graphing the differential equation, dsolve is used to solve the equation and ezplot is used to plot it ode12a = 'D2y + 2*Dy + 2*y = sin(t)' ; sol12a = dsolve(ode12a, 'y(0) = 0' , 'Dy(0) = 0' ) hold on ezplot(sol12a , [0 pi]); title 'Graph of solution for D2y + 2*Dy + 2*y = sin(t) on interval 0 to pi' ; sol12a = (2*cos(t))/(5*exp(t)) + sin(t)/(5*exp(t)) + cos(t)*(cos(2*t)/10 + sin(2*t)/5 - 1/2) - sin(t)*(cos(2*t)/5 - sin(2*t)/10) 0.5 1 1.5 2 2.5 3-0.05 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 t Graph of solution for D2y + 2*Dy + 2*y = sin(t) on interval 0 to pi b) to find the numerical values for y(pi) and y'(pi) I used the %substitution method to sub in pi for the solution to part a and into the %derivative for the solution for part a ypi = subs(sol12a , t , pi) Dy = diff(sol12a); Dypi = subs(Dy, t, pi) ypi = 0.3827 Dy =cos(t)*((2*cos(2*t))/5 - sin(2*t)/5) - (3*sin(t))/(5*exp(t)) - cos(t)/ (5*exp(t)) - cos(t)*(cos(2*t)/5 - sin(2*t)/10) + sin(t)*(cos(2*t)/5 + (2*sin(2*t))/5) - sin(t)*(cos(2*t)/10 + sin(2*t)/5 - 1/2) Dypi =-0.1914 ode12b = 'D2y + 2*Dy + 2*y = 0' ; %solution of the differential equation with the new initial condidtions sol12b = dsolve(ode12b , 'y(pi) = 0.3827' , 'Dy(pi) = -0.1914' ) ezplot(sol12b , [pi 15]); sol12b =- (3827*exp(pi)*cos(t))/(10000*exp(t)) - (1913*exp(pi)*sin(t))/(10000*exp(t)) 4 5 6 7 8 9 10 11 12 13 14 15-0.02 0.02 0.04 0.06 0.08 0.1 t D2y + 2*Dy + 2*y = 0 with the initial conditions y(pi) = 0.3827 Dy(pi) = -0.1914 Graphs of both solutions on interval 0<t<15 5 10 15-0.6-0.4-0.2 0.2 0.4 t solution toD2y + 2*Dy + 2*y = 0 on interval 0<t<15 c) syms s t Y % first define the variables eqn = sym( 'D(D(y))(t) + 2*D(y)(t)+2*y(t) = heaviside(t)*sin(t) + heaviside(t- pi)*(-sin(t))' ); % defining the differential equation lteqn = laplace(eqn , t , s); %finding the laplace transform neweqn = subs(lteqn, { 'laplace(y(t),t,s)' , 'y(0)' , 'D(y)(0)' }, {Y,0,0}); %applying initial conditions to laplace equation ytrans = solve(neweqn, Y); y = ilaplace(ytrans, s , t) %finding the inverse laplace transform ezplot(y, [0 15]); title 'graph of Laplace Transform solution for D2y + 2Dy +2y = 0' ylabel y ; xlabel t y = sin(t)/5 - (2*cos(t))/5 + (2*(cos(t) + sin(t)/2))/(5*exp(t)) - heaviside(t - pi)*(sin(t)/5 - (2*cos(t))/5 + (2*exp(pi - t)*(cos(t) + sin(t)/2))/5) 5 10 15-0.05 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 t graph of Laplace Transform solution for D2y + 2Dy +2y = 0 y As you can see from the graph, the laplace transform method produces the same graph as finding the separate solutions for each case of the overall differential equation. d) The general solution of the associated homogenous equation is C1exp(- t)cos(sqrt(2)t) + C2exp(-t)sin(sqrt(2)t) as t goes to infinity the exp(-t) terms in the solution approach zero this means that after t=pi the inhomogeous equation will approach 0 13 a) syms s t Y %first define the variables title 'graph of the forcing function'...
View Full Document

{[ snackBarMessage ]}

### Page1 / 17

Problem Set E - Joey Hartstein Kelley Heffner Problem Set E...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online