Approximate Integral with Euler's Method in Matlab

  • Context: MATLAB 
  • Thread starter Thread starter John31
  • Start date Start date
  • Tags Tags
    Integration
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
John31
Messages
5
Reaction score
0
I have a very complex integral I am trying to approximate the integral with in Matlab using Euler's method.

I derived the following function from the original so I do not need an analytical derivative, I just need some help deciphering the argument that is being presented.
Code:
dydx=@(Isp) 2943./100000./(2-1./12500000*(Isp-5000).^2)-2943./100000.*Isp./(2-1/12500000.*(Isp-5000).^2).^2.*(-1./6250000.*Isp+1./1250)-70000000000/981./Isp.^2.*exp(-1400000/981./Isp)

I have already written an m-file for Euler's method and the function labels are as follows:

Code:
[t,y] = eulode(dydt, tspan, y0, h,)
tspan= [ti,tf] where ti and tf = initial and final values of independent variables
y0=initial value of dependent variable
h= step size
However since the equation I want to integrate only has one variable I am a little confused on how to incorporate Euler's method.
 
Physics news on Phys.org
Well, if your Euler m-file behaves like ode45, you should just be able set some interval t, set your initial conditions, step size, and call the function.