Error Message: Subscript indices must either be real positive integers or logicals. This occurs when running the for loop for the very last value of a. Perhaps someone may be able to assist me.
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
sigma_lam=.7; sigma_m=.3; sigma_k=1-sigma_m; intgr=ones(1,1101); z=0:1100; zint=(z+1).^(-1); D_1=((sigma_lam*((z+1).^(-3))+sigma_k*((z+1).^(-1))+sigma_m).^(.5))./(z+1).^(-1.5); a=linspace(1/1101,1,1101); aa=num2cell(a); zplusone=0:1100; zplusone=fliplr(zplusone); zplusonea=num2cell(zplusone); scalefactor_z= containers.Map(aa,zplusonea);
for a=linspace(1/1101,1,1101); x=0:.0001:a; y=x.^(1.5)./((sigma_lam*x.^3+sigma_k*x+sigma_m).^(1.5)); intgr(1,scalefactor_z(a))=trapz(x,y); end
intgr=fliplr(intgr);
global D_fin
D_fin=intgr.*D_1;
for i=1:1101 f_col(1,i)=erfc(1.69/(sqrt(2)*D_fin(i)*7)); end
plot(z,f_col)
%sigma(M,z)=(D(z)/D(0))*sigma(M,0); %put in D(z)
%then plot f_col
1 个评论
per isakson
2013-12-6
With the help of the button, {}Code, you could make the code readable.
回答(1 个)
per isakson
2013-12-6
编辑:per isakson
2013-12-6
The error occurs for the line
intgr(1,scalefactor_z(a)) = trapz(x,y);
because with a equal to 1
K>> scalefactor_z(a)
ans =
0
which is not a positive integer
0 个评论
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!