Question: Solve the ODE Use the Euler forward method ( forward differencing ) Consider the following values of B = 0 B = - 0 .
Solve the ODE
Use the Euler forward method forward differencing
Consider the following values of
B
B
B
Discretization
Solve it on the interval:
n with nn points
discretize eta
define start value of eta: etas
define end value of eta: etae
define number of points: neta
discretize eta
preallocate arrays to store solution
store solution for beta case in yb
store solution for beta case in yb
store solution for beta case in yb
NOTE: each solution vector needs to hold neta rows and columns
where neta is the number of points used to discretize eta
define ode function to update solution
define an anonymous function function handlewith thefollowing properties
name: dydeta
inputs: y and beta, where y is a row vector with values and beta is a scalar
ouptuts: a row vector with the rate of change of the state defined with the reduced order system above
ode check
define a row vector names ycheck with the values: and
assign a variable named betacheck the value
call the previously define function dydeta with the inputs ycheck and betacheck and store the result in dycheck
solve the ode for case beta
assign beta value
apply initial condition provided for beta
solve the ode using forward differencing
solve the ode for case beta
assign beta value
set initial condition for beta
solve the ode using forward differencing
solve ode for case beta
assign beta value
set initial condition for beta
solve the ode using forward differencing
plot results
plot the second column of ybover eta as a blue line with line width
in the same plot add:
the second column of ybover eta as a red line with line width
the second column of ybover eta as a green line with line width
customize the plot
switch on the grid
set font size to
Reduced order system:
yy
yy
yyyBy
Initial conditions:
B case:
yn
yn
yn
B case:
yn
yn
yn
B case:
yn
yn
yn
MATLAB code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
