Question: Using MATLAB with the templates provided; keep getting errors in the live editor %%ODE45 template clear; clc; dydx = @(x,y) [];% ODE equations [x,y] =

Using MATLAB with the templates provided; keep getting errors in the live editor
%%ODE45 template
clear; clc; dydx = @(x,y) [];% ODE equations [x,y] = ode45(dydx,0:0.01:10,[5;-2;0]); % Solver, step size, and Initial Conditions plot(x,y(:,:)) %Plot
%%Forward Template
clear; clc; nsteps = 100;%Change this dt = 0.5;%Change this y0 = 1; %Change this yplot = zeros(1,nsteps); tplot = zeros(1,nsteps); yplot(1)=1; for j = 1:nsteps t = (j-1)*dt; y = y0+dt*('Equation');%Change this For the Equation in your problem tplot(j+1) = t+dt; yplot(j+1) = y; y0 = y; end disp('Using Forward Method'); plot(tplot,yplot,'r')
%%BAckward Template
%Syntax For Backward; nsteps = 10;%Change this dt = 0.1;%Change this y1o = 1; %Change this yplot = zeros(1,nsteps); tplot = zeros(1,nsteps); y1plot(1)=1; for j = 1:nsteps t = j*dt; ynew = ('ODE'); tplot(j+1) = t; y1plot(j+1) = ynew; y1o = ynew; end disp('Using Backward'); plot(tplot,y1plot,'r')
2. Solve the following differential equations using both ode45 function in MATLAB, Backward and Forward Euler's method. dy1-sin(t) y(0-te [0,4] y"+ y+ y- cos(x)y(0)-0 y(0-1x e[0, pi] y"" +3y','-4y'46 y'-2y-100 y(0)-6 y'(0)-2 y"(0)-0 y'"(0)-1 xt[0, 10] Plot all your solved differential equations with respect to each method 2. Solve the following differential equations using both ode45 function in MATLAB, Backward and Forward Euler's method. dy1-sin(t) y(0-te [0,4] y"+ y+ y- cos(x)y(0)-0 y(0-1x e[0, pi] y"" +3y','-4y'46 y'-2y-100 y(0)-6 y'(0)-2 y"(0)-0 y'"(0)-1 xt[0, 10] Plot all your solved differential equations with respect to each method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
