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 =0
B =-0.199
B =0.8
Discretization
Solve it on the interval:
0<=n <=10with n_n =1000points
discretize eta
define start value of eta: eta_s
define end value of eta: eta_e
define number of points: n_eta
discretize eta
preallocate arrays to store solution
store solution for beta =0case in yb1
store solution for beta =-0.199case in yb2
store solution for beta =0.8case in yb3
NOTE: each solution vector needs to hold n_eta rows and 3columns
where n_eta is the number of points used to discretize eta
define ode function to update solution
define an anonymous function (function handle)with thefollowing properties
name: dydeta
inputs: y and beta, where y is a row vector with 3values 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 y_check with the values: 1,2and 3
assign a variable named beta_check the value -1
call the previously define function dydeta with the inputs y_check and beta_check and store the result in dy_check
solve the ode for case 1(beta =0)
assign beta value
apply initial condition provided for beta =0
solve the ode using forward differencing
solve the ode for case 2(beta =-0.199)
assign beta value
set initial condition for beta =-0.199
solve the ode using forward differencing
solve ode for case 3(beta =0.8)
assign beta value
set initial condition for beta =0.8
solve the ode using forward differencing
plot results
plot the second column of yb1over eta as a blue line with line width 4
in the same plot add:
the second column of yb2over eta as a red line with line width 4
the second column of yb2over eta as a green line with line width 4
customize the plot
-switch on the grid
-set font size to 20
Reduced order system:
y`1=y2
y`2=y3
y`3=-y1(y3)-B[1-(y2)^2]
Initial conditions:
B =0case:
y1(n=0)=0
y2(n=0)=0
y3(n=0)=0.4696
B =-0.199case:
y1(n=0)=0
y2(n=0)=0
y3(n=0)=-0.0008
B =0.8case:
y1(n=0)=0
y2(n=0)=0
y3(n=0)=1.1172
MATLAB code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!