I have problem with my coding. Attempted to access LPi(4); index out of bounds because numel(LPi)=3. Error in PDF_Repi_Mw_amax_PGA (line 286) if LPi(i)<5.0;

1 view (last 30 days)
for i=1:length(rd) for j=1:length(amaxnew) %for k=1:length(Ksigm) CSR(i,j)= 0.65*(amaxnew(j))/g*(dt(6)/Di(6))*(rd(i))*100; %end end end
% % % saving pga curve in a file CSR1=[amaxnew(j), CSR(j)]; CSR1=CSR'; fid_X=fopen('CSR1.txt','wt'); fprintf(fid_X,'%3.6f %2.6f\n', CSR1); fclose(fid_X);
%Ksigm = (Di(i)/Pa)^(f-1);
%Calculate Cyclic Resistance Ratio (Ovando Shalley, 2015 and Andrus Stocke, 2000) Vsl = 200; % unity = m/s soil with 35% fines %Vsll = 220; % unity = m/s, soil with 20% fines %Vsll = 215 - 220 m/s soil with 5 % fines a=0.022; b=2.8;
for i=1:n;
A(i,1)=(1/(Vsl-Vsc(i)));
B(i,1)=1/Vsl;
CRR(i,1) = a*((Vsc(i)/100)^2)+b*(A(i,1)-B(i,1))*MSF(i);
end
%curve fitting Vsc vs CRR f = fit(Vsc,CRR,'poly2');
%sorting the Vsc [Vscsorted,I] = sort(Vsc); CRRsorted(i) = CRR(i);
%Calculation Factor of Safety -FS CRRsmooth = f(Vscsorted)*2; for i=1:n;
FS(i,1)=(CRRsmooth(i)/CSR(i));
end
J=10; K=0.5;
%Calculation Liquefaction Potential Index - LPI n=length (depth); for i=1:n; if FS(i) <= 1 && depth(i)<20; % F=1-Fs LPi(i)= (1-FS(i)).*(J - K*depth(i));
else if FS(i) > 1 && depth(i)>20;
LPi(i)= 0;
end
end
end
%Evaluation Liquefaction Potential
fid_X=fopen('Liq_BH2095.txt','w'); for i=1:n if LPi(i)<5.0; disp([num2str(i),'Not_Liquefaction']) teks_i = 'Not_Liquefaction' else disp([num2str(i),'Liquefaction']) teks_i = 'Liquefaction' end
fprintf(fid_X,'%2.4f %2.4f %2.4f %2.4f %10s\n', depth(i),CSR(i), FS(i), LPi(i), teks_i);
end fclose(fid_X);
%Plot grafik depth vs LPi FigXY1=1606; clf(figure(FigXY1)) set(FigXY1,'Position', [60 342 1600 556])
plot(depth,LPi,'b'); grid on xlabel('depth, m'); ylabel('LPi');
%title('Grafik Shear Wave velocity'); grid on view(90,90) set(gca,'yaxislocation','right') hold on [xi, yi] = ginput(1); fprintf(1,'Depth = %f\n',xi) %#ok<PRTCAL> LPi=LPi';
%yi = input('Masukkan nilai x =') Liqline = [LPi xi(ones(length(depth),1))]; plot(Liqline(:,2),Liqline(:,1),'-r','linewidth',2) text(xi,yi,[num2str(yi),' ',num2str(xi)],'HorizontalAlignment','right',... 'Margin',10) text(5,4,'LIQUEFACTION','HorizontalAlignment','center',... 'Margin',10) text(16,4,'NOT LIQUEFACTION','HorizontalAlignment','center',... 'Margin',10)
%Plotting Figure FigXY1=1708 clf(figure(FigXY1)) set(FigXY1,'Position', [60 342 1600 556]) plot(f,Vsc,CRR); grid on; xlabel('Vsc(m)'); ylabel('CRR [m/s]'); % view(90,90) % set(gca,'yaxislocation','right')

Answers (0)

Categories

Find more on Agriculture in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!