Approximate Integral with Euler's Method in Matlab

  • Context: MATLAB 
  • Thread starter Thread starter John31
  • Start date Start date
  • Tags Tags
    Integration
Click For Summary
SUMMARY

The discussion focuses on approximating a complex integral using Euler's method in Matlab. The user has derived a specific function for the integral, defined as 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). They have created an m-file for Euler's method with parameters [t,y] = eulode(dydt, tspan, y0, h), where tspan specifies the time interval, y0 is the initial value, and h is the step size. The user seeks clarification on implementing Euler's method for a single-variable integral.

PREREQUISITES
  • Understanding of Matlab programming and syntax
  • Familiarity with numerical methods, specifically Euler's method
  • Knowledge of function handles in Matlab
  • Basic concepts of integral calculus
NEXT STEPS
  • Study the implementation of Euler's method in Matlab with examples
  • Learn about Matlab's ode45 function for solving ordinary differential equations
  • Explore the concept of function handles and their applications in Matlab
  • Research numerical integration techniques beyond Euler's method, such as Runge-Kutta methods
USEFUL FOR

Matlab programmers, students in numerical analysis, and engineers looking to approximate integrals using numerical methods.

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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
3K
Replies
27
Views
4K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K