# Definite integral without symbolic variables

54 views (last 30 days)
Pilar Jiménez on 18 Feb 2020
Answered: Star Strider on 18 Feb 2020
Hi good day.
I want to request your support to know if it is possible to perform a definite integral without the use of matlab integration commands since it asks for symbolic variables to be established and I need to work with variables that are defined. I need to perform this integration as part of a larger algorithm and that is why I need them not to be symbolic variables.
An example of the function that I must integrate is the following:
k = 2*pi;
L1=0.5;
L2=0.5;
d=0.2;
R1 = sqrt(d^2 + 0.5^2);
R2 = sqrt(d^2 + 0.6^2);
R0 = sqrt(d^2 + 0.7^2);
G1 = exp(-j*k*R1)./R1;
G2 = exp(-j*k*R2)./R2;
G0 = exp(-j*k*R0)./R0;
fun = (G1 + G2 - 2*cos(k*L1/2) * G0) .* sin(k*(L2/2-abs(z)));
The integral is defined with respect to z from -L1 / 2 to L1 / 2. I hope you can help me.

Star Strider on 18 Feb 2020
Create ‘fun’ as an anonymous function, then use the integral function:
fun = @(z) (G1 + G2 - 2*cos(k*L1/2) * G0) .* sin(k*(L2/2-abs(z)));
Iz = integral(fun, -L1/2, L1/2)
producing:
Iz =
-0.912687739195403 + 0.513810248651795i

### Categories

Find more on Number Theory in Help Center and File Exchange

R2014a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!