Plot of the function after integration

1 Ansicht (letzte 30 Tage)
Yuriy Yerin
Yuriy Yerin am 12 Okt. 2018
Kommentiert: Yuriy Yerin am 15 Okt. 2018
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 Kommentare
Torsten
Torsten am 15 Okt. 2018
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.
Yuriy Yerin
Yuriy Yerin am 15 Okt. 2018
Me too, but anyway thank you again for the help. I will google about that.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by