Plot of the function after integration
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello. I want to plot a complicated function. Unfortunately at the end I obtain just one point of the function and the empty graph. I'd like to avoid exploitation of the command for to speed up my calculations. Could you explain where is my mistake? Thank you. Below is my code
function z=test_plot
tic
tt=-0.000689609;t=0.242731; muu=0.365908;
[m,NN]=meshgrid(0:100,-3000:1:3000);
y1= @(N,q,k) t*q./k.*log((-k.^2+2*k.*q-q.^2+muu+1i*(2*pi*N.*t-(2*m(1,:)+1)*pi*t))./(-k.^2-2*k.*q-...
q.^2+muu+1i*(2*pi*N.*t-(2*m(1,:)+1)*pi*t)))./(tt*pi+integral(@(a)a.*tanh((a.^2-muu)./(2*t)).*log((2*a.^2+2*a.*q+...
q.^2-2*muu-1i*2*pi*N*t)./(2*a.^2-2*a.*q+q.^2-2*muu-1i*2*pi*N*t))./q-2,0,10000,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true));
R1=@(q,k) integral(@(N)y1(N,q,k),3000,10^6,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true);
R11=@(q,k) integral(@(N)y1(N,q,k),-10^6,-3000,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true);
y2=@(q,k) t*q./k.*log((-k.^2+2*k.*q-q.^2+muu+1i*(2*pi*NN(:,1).*t-(2*m(1,:)+1)*pi*t))./(-k.^2-2*k.*q-...
q.^2+muu+1i*(2*pi*NN(:,1).*t-(2*m(1,:)+1)*pi*t)))./(tt*pi+integral(@(a)a.*tanh((a.^2-muu)./(2*t)).*log((2*a.^2+2*a.*q+...
q.^2-2*muu-1i*2*pi*NN(:,1).*t)./(2*a.^2-2*a.*q+q.^2-2*muu-1i*2*pi*NN(:,1).*t))./q-2,0,10000,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true));
R2=@(q,k) sum(y2(q,k));
S=@(q,k) R1(q,k)+R11(q,k)+R2(q,k)-4*sqrt(2)/pi*(1/1000)/(pi^(3/2)*sqrt(t))*q.^2;
Sigma=@(k) integral(@(q)S(q,k),0.001,7,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true);
Sum_sigma=@(k) 2*real(sum(Sigma(k)./((1i*(2*m(1,:)+1)*pi*t-k.^2+muu-Sigma(k)).*(1i*(2*m(1,:)+1)*pi*t-k.^2+muu))));
k=0.001:0.05:5.01;
Sum_sigma(k)
plot(k,Sum_sigma(k))
toc
end
댓글 수: 12
Torsten
2018년 10월 15일
I have no experience with parallel computing in MATLAB. But since the calculations for different k-values are independent, it should somehow be possible to parallelize here.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!