0001 function plotEcFVA(minFlux, maxFlux)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 numMods = size(minFlux,2);
0013 fluxRanges = cell(3,1);
0014
0015 for i=1:numMods
0016 zeroFlux = abs(minFlux(:,i)) < 1e-10 & abs(maxFlux(:,i)) < 1e-10;
0017 minFlux(zeroFlux,i) = NaN;
0018 maxFlux(zeroFlux,i) = NaN;
0019 fluxRange = maxFlux(:,i) - minFlux(:,i);
0020 fluxRange(isnan(fluxRange)) = [];
0021 fluxRanges{i} = fluxRange;
0022 end
0023
0024
0025 hold on
0026 legendText = cell(1,numel(numMods));
0027 for i=1:numMods
0028 fluxRange = fluxRanges{i};
0029 cdfplot(fluxRange)
0030 legendText{i} = (['Model #' num2str(i) ' (median: ' num2str(median(fluxRange,'omitnan')) ')']);
0031 end
0032 set(gca, 'XScale', 'log', 'Xlim', [1e-7 1e4])
0033 set(findall(gca, 'Type', 'Line'), 'LineWidth', 2)
0034 legend(legendText, 'Location','northwest')
0035 title('Flux variability (cumulative distribution)');
0036 xlabel('Variability range (mmol/gDCWh)');
0037 ylabel('Cumulative distribution');
0038 hold off
0039 end
0040
0041 function cdfplot(X)
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 tmp = sort(reshape(X,prod(size(X)),1));
0065 Xplot = reshape([tmp tmp].',2*length(tmp),1);
0066
0067 tmp = [1:length(X)].'/length(X);
0068 Yplot = reshape([tmp tmp].',2*length(tmp),1);
0069 Yplot = [0; Yplot(1:(end-1))];
0070
0071 figure(gcf);
0072 hp = plot(Xplot, Yplot);
0073
0074 ColOrd = get(gca, 'ColorOrder');
0075 ord = mod(length(get(gca,'Children')), size(ColOrd,1));
0076 set(hp, 'Color', ColOrd((ord==0) + (ord>0)*ord, :));
0077 if ~ishold
0078 xlabel('X', 'FontWeight','b','FontSize',12);
0079 ylabel('F(X)', 'FontWeight','b','FontSize',12);
0080 title('Empirical CDF', 'FontWeight','b','FontSize',12);
0081 grid on;
0082 end
0083 end