Question

In: Advanced Math

Solve y'=4-t+2y; y(0)=1. Generate data-point solutions for t=0,1,2,3,4,5 (i) Stepsize h=0.1 (ii) Stepsize h=0.01

Solve y'=4-t+2y; y(0)=1. Generate data-point solutions for t=0,1,2,3,4,5
(i) Stepsize h=0.1
(ii) Stepsize h=0.01

Solutions

Expert Solution

% We will solve this problem by Euler's Method

clc;

clear all;

c=1;

h = 0.1; % initial step size

for j=1:2

t = 0:h:5; % the range of t

y = zeros(size(t)); % allocate the result y

y(1) = 1; % the initial y value

n = numel(y); % the number of y values

% The loop to solve the ODE

for i=1:n-1

f = 4-t(i)+2*y(i); % The given function

y(i+1) = y(i) + h * f; % formula for Euler's method.

end

fprintf('The solutions with step size %f\n',h)

fprintf('t \t y(t)\n')

fprintf('------------------------------\n')

a=0;

b=1;

for i=1:6

fprintf('%.0f \t %f\n',a,y(b))

a=a+1;

b=b+(c*10);

end

h=h*0.1;

c=10;

end


Related Solutions

Find solutions to the following ODEs: • y¨ − y˙ − 2y = t, y(0) =...
Find solutions to the following ODEs: • y¨ − y˙ − 2y = t, y(0) = 0, y˙(0) = 1 • y¨ − 2 ˙y + y = 4 sin(t), y(0) = 1, y˙(0) = 0 • y¨ = t 2 + t + 1 (find general solution only) • y¨ + 4y = t − 2 sin(2t), y(π) = 0, y˙(π) = 1
Solve the equation below for y(t): y''+2y'-3y=8u(t-3): y(0) = 0; y'(0)=0
Solve the equation below for y(t): y''+2y'-3y=8u(t-3): y(0) = 0; y'(0)=0
u(t−c) =uc(t) ={0, 0≤t<c,1, t≥c.} USE Laplace Transform to solve y′′+ 2y′+ 2y=δ(t−5)e^tcost, y(0) = 1,...
u(t−c) =uc(t) ={0, 0≤t<c,1, t≥c.} USE Laplace Transform to solve y′′+ 2y′+ 2y=δ(t−5)e^tcost, y(0) = 1, y′(0) = 2, whereδ(t)is the Dirac delta. Does the solution show a resonance?
Solve the differential equation by Laplace transform y^(,,) (t)-2y^' (t)-3y(t)=sint   where y^' (0)=0 ,y=(0)=0
Solve the differential equation by Laplace transform y^(,,) (t)-2y^' (t)-3y(t)=sint   where y^' (0)=0 ,y=(0)=0
if y(t) is the solution of y′′+2y′+y=δ(t−3),y(0)=0,y′(0)=0 the find y(4)
if y(t) is the solution of y′′+2y′+y=δ(t−3),y(0)=0,y′(0)=0 the find y(4)
Solve the following IVPs: A. y"" +2y′′+y = 4et, y(0)=1,  y′(0)=1, y′′(0)=1, y′′′(0)=1. B. y′′′+25y′ = 325e−t,...
Solve the following IVPs: A. y"" +2y′′+y = 4et, y(0)=1,  y′(0)=1, y′′(0)=1, y′′′(0)=1. B. y′′′+25y′ = 325e−t, y(0) = 0, y′(0) = 0, y′′(0) = 0.
Solve with Laplace transform 1. y''+ 4 t y'− 4y = 0, y(0) = 0, y'(0)...
Solve with Laplace transform 1. y''+ 4 t y'− 4y = 0, y(0) = 0, y'(0) = −7 2. (1− t) y''+ t y' − y = 0, y(0) = 3, y'(0) = −1
y''+ 3y'+2y=e^t y(0)=1 y'(0)=-6 Solve using Laplace transforms. Then, solve using undetermined coefficients. Then, solve using...
y''+ 3y'+2y=e^t y(0)=1 y'(0)=-6 Solve using Laplace transforms. Then, solve using undetermined coefficients. Then, solve using variation of parameters.
Solve the following problems: (a) y'' - 2y' + 5y = 0 with y(0) = 1...
Solve the following problems: (a) y'' - 2y' + 5y = 0 with y(0) = 1 and y'(0) = 2. (b) y(3) - 3y' + 2y = 0 with y(0) = 5, y'(0) = 6, and y''(0) = 11.
a) Solve IVP: y" + y' -2y = x + sin2x; y(0) = 1, y'(0) = 0
  a) Solve IVP: y" + y' -2y = x + sin2x; y(0) = 1, y'(0) = 0 b) Solve using variation of parameters: y" -9y = x/e^3x
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT