Why am I getting "incompatible array size error" when I am using only scalars in a nested integration problem
Show older comments
lambda_p=1;
lambda_d=20;
a=0.25;
alpha=3.5;
tau=linspace(0.01,30,5);
cov_prob=zeros(1,length(tau));
g= @(r,s) (1/a).*r.*(abs(r-s)<a);
attenuation= @(r) (abs(r)).^(-alpha);
f= @(u,r,s,tau) (1./(1+tau.*(attenuation(u)./attenuation(r)))) .* g(u,s);
in= @(r,s,tau) integral(@(u) f(u,r,s,tau),r,inf);
CC= @(r,s,tau) exp(-lambda_d.*(1-in(r,s,tau)));
fc= @(r,x,tau) g(r,x).*CC(r,x,tau);
i1= @(r,tau) integral(@(x) fc(r,x,tau),0,inf);
i2= @(r,tau) integral(@(x) 1-CC(r,x,tau),0,inf);
disp(fc(1,1,1.1)) %works fine
disp(i1(1,1.1)) % causing error
for i=1:length(tau)
disp(i);
fcc= @(r) i1(r,tau(i)).*exp(-lambda_p.*i2(r,tau(i)));
i_f= integral(@(r) fcc(r),0,inf);
cov_prob(i)=lambda_d.*lambda_p.*i_f;
end
g,f,in,CC,fc: these functions are returning valid outputs. Error starts origination from functions i1, i2 onwards.
Any help/leads will be greatly appreciated. Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Profile and Improve Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!