MATLAB Approximate Integral with Euler's Method in Matlab

  • Thread starter Thread starter John31
  • Start date Start date
  • Tags Tags
    Integration
AI Thread Summary
The discussion focuses on approximating a complex integral using Euler's method in Matlab. A specific function has been derived to avoid needing an analytical derivative, which poses challenges in its implementation. The user has created an m-file for Euler's method with defined parameters such as time span, initial conditions, and step size. Clarification is sought on how to effectively apply Euler's method given that the integral involves only one variable. The consensus suggests that if the m-file functions similarly to ode45, it should be straightforward to set the necessary parameters and execute the function.
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.
 
Back
Top