-
Notifications
You must be signed in to change notification settings - Fork 2
/
solver_fh.m
42 lines (33 loc) · 1.08 KB
/
solver_fh.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function [ solver_fh ] = solver_fh(Nelem, dx, Tol)
if nargin<3
RelTol = eps;
AbsTol = eps;
else
RelTol = Tol;
AbsTol = Tol;
end
shoot = shoot_fh(Nelem,dx);
dens = @(E,v,vL,vR) ldos(shoot(E,v,vL,vR));
resp = @(E,v,vL,vR) response(shoot(E,v,vL,vR));
% return function handle
solver_fh = @densitysolve;
function [n,response] = densitysolve(mu,v,vL,vR)
E0 = min(v)-1;
R = (E0+mu)/2;
A = mu-R;
E = @(theta) R + A*exp(1i*theta);
dEdt = @(theta) 1i*A*exp(1i*theta);
n = integral(@(theta) dens(E(theta),v,vL,vR)*dEdt(theta),0,pi,...
'ArrayValued',true,...
'RelTol',RelTol,...
'AbsTol',AbsTol);
n = n+conj(n);
if nargout>1
response = dx*integral(@(theta) resp(E(theta),v,vL,vR)*dEdt(theta),0,pi,...
'ArrayValued',true,...
'RelTol',1e-1,...
'AbsTol',1e-1);
response = response+conj(response);
end
end
end