Why is the following numerical integration not working?

1 visualización (últimos 30 días)
Peng Peng Zheng
Peng Peng Zheng el 6 de Oct. de 2020
Respondida: randerss simil el 9 de Feb. de 2021
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'

Respuestas (2)

Star Strider
Star Strider el 6 de Oct. de 2020
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 el 9 de Feb. de 2021
TMD = integral2(area,0,2,0,2*pi);
Alternate way

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by