%%Matlab code for solving ode
clear all
close all
%Initial conditions for ode
u0=[0;1;1];
h=1;
%Solution for equation using ode45
%minimum and maximum
time span
tspan=[0 5];
%Solution of ODEs using
ode45 matlab function
[x,s]= RK2System(@(t,y)
odel_equation(t,y), tspan, u0,h);
fprintf('Solution using
RK2 method for h=1\n')
for i=1:length(s)
fprintf('At x=%2.2f y(%2.2f)=%2.2e,\n\t dy(%2.2f)/dx=%2.2e\n\t
z(%2.2f)=%2.2e\n',...
x(i),x(i),s(1,i),x(i),s(2,i),x(i),s(3,i))
end
figure(1)
plot3(s(1,:),s(2,:),s(3,:),'b','linewidth',2)
xlabel('y(x)')
ylabel('dy(x)/dt')
zlabel('z(x)')
title('Solution plot
using RK2')
box on
grid on
view([0 0]);
figure(2)
plot(x,s(1,:),'b','linewidth',2)
ylabel('y(x)')
xlabel('x')
title('Solution plot
using RK2 x vs. y(x)')
box on
grid on
figure(3)
plot(x,s(2,:),'b','linewidth',2)
ylabel('dy(x)/dx')
xlabel('x')
title('Solution plot
using RK2 x vs. dy(x)/dx')
box on
grid on
figure(4)
plot(x,s(3,:),'b','linewidth',2)
ylabel('z(x)')
xlabel('x')
title('Solution plot
using RK2 x vs. z(x)')
box on
grid on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function for evaluating the ODE
function dydt = odel_equation(x,y)
eq1 = y(2);
eq2 = 6.*exp(3.*x)-(y(1)).^2+2.*y(3);
eq3 = 6.*(y(3)).^2+3.*y(1);
%Evaluate the ODE for our present problem
dydt = [eq1;eq2;eq3];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%RK4 system for multidimentional problem
function [t,y]=RK2System(Func,Tspan,Y0,h)
%initialization
t0= Tspan(1);
tf= Tspan(2);
N=(tf-t0)/h ;
t=t0:h:tf;
y=zeros(length(Y0),N+1);
y(:,1) = Y0;
for i=1:N
k1=h*Func(t(i),y(:,i));
k2=h*Func(t(i)+h/2,y(:,i)+k1/2);
y(:,i+1)=y(:,i)+k2;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Problem 3. Consider the following second-order linear differential equation with the given initial conditions: I day = 6 x 10-6(x – 100) dx2 Initial Conditions at x = 0: y = 0 and dy dx = 0 Determine y at x =100, with a step size of 50 using: a) Euler's method, b) Heun's method with one correction.
Problem # 1: (70 points) Solve the following problems (a) and (b) using Laplace Transform: a) (7 points) y(0)-y'(0)-0 y"(0)-1 b) (dX/d't) + 3 (dy/dt) + 3y-0 (7 points) (d'x/d't) +3y-te' x(0) = 0 x'(0) = 2 y(0) = 0 c) An nxn matrix A is said to be skew-symmetric if AT--A. If A is a 5x5 skew-symmetric matrix, show that 9detA)-0 (4 Points) d) Suppose A is a 5x5 matrix for which (detA) =-7, what is the value of...
Please show steps. Given 3 dy/dx + 2xy^2 = 5x^2 - x + 1, where y(0) = 5 and using a step size of dx = 1, the value of y(1) using Euler's method is most nearly 5.333 1.010 -0.499 17.822 Given 3 dy/dx + 2xy^2 = 5x^2 - x + 1, where y(0) = 5 and using a step size of dx = 1, the value of y(1) using Runge-Kutta 4^th order method is most nearly 5.333 1.010 -0.499...
using matlab thank you 3 MARKS QUESTION 3 Background The van der Pol equation is a 2nd-order ODE that describes self-sustaining oscillations in which energy is withdrawn from large oscillations and fed into the small oscillations. This equation typically models electronic circuits containing vacuum tubes. The van der Pol equation is: dt2 dt where y represents the position coordinate, t is time, and u is a damping coefficient The 2nd-order ODE can be solved as a set of 1st-order ODEs,...
How to do question B 2,3,4,5? 3. a) Find the solution v ote ordinary diferetinl equation with the initial coditions: b) i) Recast our third ord ODE into a system af first order ODEs af the formA.v, where v' = dv/dz f(v) and v = (y, y,y")". You should show all working to find the corresponding matrix A. Do not solve the system. 4 mark Solve it only by hand and show your complete work. Do not use a calculator...