Hi, i wrote a code for earthquake hazard analysis but when i try to execute the code its like it never ends, i has been 5 hours that try to run the program with the code and it is not look like a code that is so heavy for program execution, would please help me in this?
source1=csvread('C:\Users\Arman\Desktop\Matlab\CSVread\1st source_grid_csv.csv');site=[60.5,31.5];Mmin=4;DM=0.1;c1=-1.09;c2=0.238;c3=-1;c4=-0.0005;sigma=0.15;sumNy=zeros(1,1.5/0.01);CellArea=0.01*112.2*0.01*96.3;for i=1:521for j=1:400if source1(i,j)~=-9999;Celldecimal=[(57.935+(j-1)*0.01),(34.108-(i-1)*0.01)];R=acos(sin(site(1,2)*pi/180)*sin(Celldecimal(1,2)*pi/180)+cos(site(1,2)*pi/180)*cos(Celldecimal(1,2)*pi/180)*cos((Celldecimal(1,1)-site(1,1))*pi/180))*6371;if source1(i,j)==1;a=-1.6739;b=0.6531;Mmax=7.8;Davg=17;beta=b*log(10);NM0=10^(a)*CellArea;NMmin=NM0*(exp(-beta*Mmin)-exp(-beta*Mmax))/(1-exp(-beta*Mmax));r=sqrt(R^(2)+Davg^(2));for PGA=0.01:0.01:1.5Nymatrix=zeros((7.9-Mmin+DM)/DM,1);for aa=Mmin:0.1:MmaxMmean=aa+0.05;Freq=NMmin*(exp(-beta*(aa-Mmin))-exp(-beta*((aa+0.1)-Mmin)))/(1-exp(-beta*(Mmax-Mmin)));loga=log10(PGA);logamean=c1+c2*Mmean+c3*log10(r)+c4*r;lognormal=1-normcdf(loga,logamean,sigma);Ny=Freq*lognormal;if aa==MminNymatrix((aa-Mmin+DM)/DM,1)=Ny;elseNymatrix(round((aa-Mmin+DM)/DM),1)=Ny+Nymatrix(round((aa-Mmin)/DM),1);endendsumNy(1,round(PGA/0.01))=sum(Nymatrix,1)+sumNy(1,round(PGA/0.01));end
sorry if the code is too long but this code wont end with this part and it has 6more elseif statements and at the end it is intended to plot some values for me.
when i look through the code it doesnt seem like it is traped in an infinity loop. you will make so glad if you help me in this. Thanks
Best Answer