taylor expansion of multivariate function
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
Would you please help me to find first-order taylor expansion of this non-linear multivariate function of 3*M variables. I try matlab tylor function for multi variable functions but I got the error that "not enough input arguments".
matlab code of this function is here:
w = [1 0 0 0];
M = length(w);
x = sym('x', [1 M]);
y = sym('y', [1 M]);
z = sym('z', [1 M]);
p0 = zeros(3, M);
a_f = @(theta, phi) 0;
for m = 1:M
f = @(theta,phi, x, y, z) (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, x, y, z) 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_phi = @(phi, x, y, z) int(@(theta) integrand(theta, phi, x, y, z), theta_limits(1), theta_limits(2));
Denominator = @(x, y, z) int(@(phi) Denominator_phi(phi, x, y, z), phi_limits(1), phi_limits(2));
% Calculate the maximum array factor
Numerator = @(x, y, z) abs(a_f(theta_max, phi_max)).^2;
% Calculate the directivity
D = @(x, y, z) 4*pi*Numerator(x,y,z) ./ Denominator(x,y,z);
L_D = taylor(D, ...
[x(1) x(2) x(3) x(4) y(1) y(2) y(3) y(4) z(1) z(2) z(3) z(4)],...
reshape(p0', 1, []), 'order', 1)
6 个评论
Torsten
2023-6-3
编辑:Torsten
2023-6-3
syms theta phi rho theta_max phi_max real
w = [1 0 0 0];
M = length(w);
x = sym('x', [1 M]);
y = sym('y', [1 M]);
z = sym('z', [1 M]);
assume(x,'real')
assume(y,'real')
assume(z,'real')
p0 = zeros(3, M);
AF(theta,phi) = sum((exp(1j*rho*(x(1:M).*sin(theta).*cos(phi) + ...
y(1:M).*sin(theta).*sin(phi) + z(1:M).*cos(theta)))).*w(1:M))
integrand = AF(theta,phi)*AF(theta,phi)'.*sin(theta)
% Define the integration limits
theta_limits = [0,pi];
phi_limits = [0,2*pi];
Denominator = int(int(integrand,theta,theta_limits(1),theta_limits(2)),phi,phi_limits(1),phi_limits(2))
Numerator = 4*pi*AF(theta_max,phi_max)*AF(theta_max,phi_max)'
D = Numerator/Denominator
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Global or Multiple Starting Point Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!