필터 지우기
필터 지우기

Plot of the function after integration

조회 수: 1 (최근 30일)
Yuriy Yerin
Yuriy Yerin 2018년 10월 12일
댓글: Yuriy Yerin 2018년 10월 15일
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
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.
Yuriy Yerin
Yuriy Yerin 2018년 10월 15일
Me too, but anyway thank you again for the help. I will google about that.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by