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!