Why is the following numerical integration not working?

2 次查看(过去 30 天)
clc;clear;close all
k = 2;theta = 0;
Integrand = Optics(k,theta);
area = @Optics;
TMD = integral2(Optics,0,2,0,2*pi);
function Integrand = Optics(k,theta)
gamma = 0.2;
pi = 3.14;
a = 0.3;
hbar = 0.2;
electron = 0.2;
w = 1;
correction = 0.001;
Normalization = 1/sqrt(2*gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)))*(exp(-1i*a*k*cos(theta))+2*exp(0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta))));
SolutionOne = Normalization*[gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)));sqrt(gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)))*(exp(-1i*a*k*cos(theta))+2*exp(0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta))))];
SolutionTwo = Normalization*[sqrt(gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)))*(exp(-1i*a*k*cos(theta))+2*exp(0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta))));-gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)))];
velocity = [0 1i*a*gamma*(exp(1i*k*a*cos(theta))-exp(-1i*k*a*cos(theta))*cos(k*sin(theta)*a*sqrt(3)/2));-1i*a*gamma*(exp(-1i*k*a*cos(theta))-exp(1i*k*a*cos(theta))*cos(k*sin(theta)*a*sqrt(3)/2)) 0];
EigenOne = sqrt(gamma*(exp(1i*a*k*cos(theta))+2*exp(-0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta)))*(exp(-1i*a*k*cos(theta))+2*exp(0.5*1i*a*k*cos(theta))*cos(sqrt(3)/2*a*k*sin(theta))));
EigenTwo = -EigenOne;
Jumper = SolutionOne'*velocity*SolutionTwo;
Integrand = k*1i*hbar*electron*electron/(2*pi)^2/(EigenOne-EigenTwo)*(Jumper')*Jumper/(hbar*w-(EigenOne-EigenTwo)+correction);
end
This is a 2D integral but Matlab always responds with 'Not enough inputs'

回答(2 个)

Star Strider
Star Strider 2020-10-6
Try this:
TMD = integral2(@Optics,0,2,0,2*pi);
(I did not run your code, so there may be other errors as well.)

randerss simil
randerss simil 2021-2-9
TMD = integral2(area,0,2,0,2*pi);
Alternate way

类别

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

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by