如何在Matlab中将函数与多维常数矩阵集成?

时间:2018-11-05 05:00:40

标签: matlab numerical-integration

我有一个功能, F = exp(-B(i,j)。* cos(x)) 其中B(i,j)是尺寸为i-j的常数矩阵

现在,我想在Matlab中以间隔(0,pi / 2)在数值上集成上述函数w.r.t'x'。

提前谢谢!

function Z = Z_normalization(E0,f)
%Evaluating the Normalization partition function for the calculation
%   Detailed explanation goes here
% E0 = electric field amplitude;
% f = frequency
% B(i,j) = product of electric dipole moment and field
%f = 10:100:1000000;
%E0 = [650, 750, 850, 950, 1000];
for j = 1:length(E0)
    for i = 1:length(f)
        %B(i,j) = E0(i).*f(j);
        B = Scalar_electric_potential(E0,f);
        F = @(x) exp(-B(j,i).*cos(x)).*cos(2.*x);
        Z(j,i) = integral(F, 0, pi/2)
    end
end
end

在这里,B(i,j)是f,E0的函数,所以当我没有exp(F)时,积分就很好。附加exp(F)时,所有值的积分结果相同。

0 个答案:

没有答案