Double integral on some variable of multivariate symbolic function
10 views (last 30 days)
Show older comments
Hello everyone,
Could you please help me to find double integral on a multivariate symbolic function in which the integral must be taken on some variables and final result must be symbolic again. the aim of this issue is to obtain first order taylor expansion of final function.
the coresponding matlab code:
w = [1 0 0 0];
M = length(w);
x = sym('x', [1 M]);
y = sym('y', [1 M]);
z = sym('z', [1 M]);
a_f = @(theta, phi) 0;
for m = 1:M
f = @(theta,phi) (exp(1j*rho*(x(m).*sin(theta).*cos(phi) + ...
y(m).*sin(theta).*sin(phi) + z(m).*cos(theta)))).*w(m);
a_f = @(theta, phi) a_f(theta, phi) + f(theta, phi);
end
% Define the integrand
integrand = @(theta,phi, x, y, z) abs(a_f(theta,phi)).^2 .* sin(theta);
% Define the integration limits
theta_limits = [0,pi];
phi_limits = [0,2*pi];
% Evaluate the integral using Matlab's 'integral2' function
Denominator = integral2(@(x,y,z) integrand, theta_limits(1), theta_limits(2), ...
phi_limits(1), phi_limits(2));
% Calculate the maximum array factor
Numerator = @(x, y, z) abs(a_f(theta_max, phi_max)).^2;
2 Comments
Dyuman Joshi
on 2 Jun 2023
You are mixing symbolic data type with numeric data. It is best to have only a single data type through-out.
Define the independent variables theta and phi as symbolic variables and proceed further with using int twice.
Also, you have not defined "rho".
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!