Why is the following numerical integration not working?

2 ビュー (過去 30 日間)
Peng Peng Zheng
Peng Peng Zheng 2020 年 10 月 6 日
回答済み: randerss simil 2021 年 2 月 9 日
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 Center および File ExchangeOptics についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by