Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help solving this differential equation in MATLAB using the shooting method. I have included the RK4 code that the problem is asking for. Just
Need help solving this differential equation in MATLAB using the shooting method. I have included the RK4 code that the problem is asking for. Just need to be able to manipualte it to solve this differential equation.
RK4 code:
function [ t,y ] = RK4(t0, y0, f,dt,tsteps) t = t0 : dt : t0+tsteps*dt; % put y's into a vector y(1,:) = y0; % to get to new y, must calculate the k's for i = 1:tsteps h2 = dt/2; ttemp = t(i) + h2; yy = y(i,:); k1 = f(t(i),yy); k2 = f(ttemp, yy + h2*k1); k3 = f(ttemp, yy + h2*k2); k4 = f(t(i+1), yy + dt*k3); y(i+1,:) = yy + dt/6 * (k1 + k4 + 2*(k2+k3)); end endWrite Matlab code to implement the shooting method for the boundary value problem d2 dz2 dy y(a) a Recall that use of the shooting method in this context requires us to solve four very silar initial value problems. Therefore, your code should include a Matlab function that your main program calls four times, once for each IVP. For this function, use the RK4 function you produced on Homework 9. Younr output should be a plot of your data points. Write Matlab code to implement the shooting method for the boundary value problem d2 dz2 dy y(a) a Recall that use of the shooting method in this context requires us to solve four very silar initial value problems. Therefore, your code should include a Matlab function that your main program calls four times, once for each IVP. For this function, use the RK4 function you produced on Homework 9. Younr output should be a plot of your data points
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started