below is a program that i am using to derive idf curves .suppose i have the code for plotting idf curve for one particular grid or place but now i need to plot 10 idf curves using that code simultaneously. i introduced a outer for loop will it do?

1 次查看(过去 30 天)
# * load allrains.txt
# * y=allrains(:,:);
# * rain=data1(:,:);
# * data=data1(:,1:10);
# * for n=1:size(data,2)
# * dataA=[];
# * for i=1:length(rain)-2
# * dataA=[dataA; sum(data(i:i+2,n))];
# * end
# * dataB=[];
# * for i=1:length(rain)-5
# * dataB=[dataB; sum(data(i:i+5,n))];
# * end
# * dataC=[];
# * for i=1:length(rain)-8
# * dataC=[dataC; sum(data(i:i+8,n))];
# * end
# * dataD=[];
# * for i=1:length(rain)-11
# * dataD=[dataD; sum(data(i:i+11,n))];
# * end
# * dataF=[];
# * for i=1:length(rain)-14
# * dataF=[dataF; sum(data(i:i+14,n))];
# * end
# * dataG=[];
# * for i=1:length(rain)-17
# * dataG=[dataG; sum(data(i:i+17,n))];
# * end
# * dataK=[]
# * for i=1:length(rain)-20
# * dataK=[dataK; sum(data(i:i+20,n))];
# * end
# *
# * dataH=[];
# * for i=1:length(rain)-23
# * dataH=[dataH; sum(data(i:i+23,n))];
# * end
# * dataI=[];
# * for i=1:length(rain)-35
# * dataI=[dataI; sum(data(i:i+35,n))];
# * end
# * dataJ=[];
# * for i=1:length(rain)-47
# * dataJ=[dataJ; sum(data(i:i+47,n))];
# * end
# *
# * % % Make padded array.....
# * M = nan(length(rain),10);
# * M(3:length(data),1) = dataA;
# * M(6:length(data),2) = dataB;
# * M(9:length(data),3) = dataC;
# * M(12:length(data),4) = dataD;
# * M(15:length(data),5) = dataF;
# * M(18:length(data),6) = dataG;
# * M(21:length(data),7) = dataK;
# * M(24:length(data),8) = dataH;
# * M(36:length(data),9) = dataI;
# * M(48:length(data),10) = dataJ;
# * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# * year=y(:,1);
# * dataset=[year M];
# * [years, ~, gg] = unique(dataset(:, 1));
# * dataset1=[gg M];
# * MaxC=[];
# * for i=1:31
# *
# * for k1 = 2:size(dataset,2)
# * maxd = max(dataset(gg==i,k1));
# * MaxCol(k1,:) = maxd;
# * end
# * MaxC=[MaxC MaxCol];
# * end
# * MaxC =(MaxC(2:end,:))';
# * mm=mean(MaxC,1);
# * stdev=std(MaxC,1);
# * recurrence=[2;5;10;25;50;100];
# * KT=[];
# * for i=1:length(recurrence)
# * gumbell_kt(i)=-(sqrt(6))/pi*(0.5772+log(log(recurrence(i)/(recurrence(i)-1))));
# * end
# * KT=[KT gumbell_kt];
# * KT=KT';
# * dataarrange=[mm' stdev'];
# * for i=1:length(dataarrange)
# * for j=1:length(KT)
# * table(i,j)=dataarrange(i,1)+KT(j).*dataarrange(i,2);
# * end
# * end
# * duration=[3;6;9;12;15;18;21;24;36;48];
# * for i=1:length(duration)
# * for j=1:length(KT)
# * intensity(i,j)=table(i,j)./duration(i);
# * end
# * end
# * PLOT(n)=plot(duration,intensity(:,1),'bd-',duration,intensity(:,2),'gd-',duration,intensity(:,3),'cd-',duration,intensity(:,4),'kd-',duration,intensity(:,5),'md-',duration,intensity(:,6),'yd-');

回答(1 个)

JAYANTH BHIMAVARAPU
Try to use subplot of MATLAB to plot different plots in a form of grid: Subplot in MATLAB
And if you add outer loop and change the variables to be plotted in each iteration, it will work. But don't forget to change the parameters of subplot too.

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by