Definite integral without symbolic variables
88 views (last 30 days)
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;
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.
Thanks in advance.
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)
-0.912687739195403 + 0.513810248651795i