Definite integral without symbolic variables

14 次查看(过去 30 天)
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.
Thanks in advance.

回答(1 个)

Star Strider
Star Strider 2020-2-18
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

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by