Changeset 880 for trunk/src/plot_field.m
- Timestamp:
- Mar 4, 2015, 12:01:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r874 r880 224 224 if ~(isfield(PlotParamOut,'Axes')&&isfield(PlotParamOut.Axes,'TextDisplay')&&(PlotParamOut.Axes.TextDisplay)) % if text is not already given as statistics 225 225 htext=findobj(hfig,'Tag','TableDisplay'); 226 % hchecktable=findobj(hfig,'Tag','CheckTable');227 226 if ~isempty(htext)%&&~isempty(hchecktable) 228 227 if isempty(index_0D) … … 577 576 578 577 %% give statistics for pdf 579 ind_var=find(testplot);578 %ind_var=find(testplot); 580 579 TableData={'Variable';'SampleNbr';'bin size';'Mean';'RMS';'Skewness';'Kurtosis';' centered ';... 581 580 'Min';'FirstCentile';'FirstDecile';'Median';'LastDecile';'LastCentile';'Max'}; 582 %PlotParamOut.TableDisplay={}; 581 583 582 TextDisplay=0; 584 583 for icell=1:numel(CellInfo) 585 584 if isfield(CellInfo{icell},'VarIndex_histo') 586 check_stat=1;587 585 TextDisplay=1; 588 586 VarName=data.ListVarName{CellInfo{icell}.CoordIndex}; 589 587 pdf_val=data.(data.ListVarName{CellInfo{icell}.VarIndex_histo}); 590 588 x=coord_x{icell}; 591 Val=zeros(12,1); 592 Val(1)=sum(pdf_val);% total sample number 593 Val(7)=min(x); 594 Val(13)=max(x); 595 Val(2)=(Val(13)-Val(7))/(numel(x)-1);%bin size 596 pdf_val=pdf_val/Val(1);% normalised pdf 597 Val(3)=sum(x.*pdf_val);%Mean 598 x=x-Val(3); %centered variable 599 Variance=sum(x.*x.*pdf_val); 600 Val(4)=sqrt(Variance); 601 Val(5)=(sum(x.*x.*x.*pdf_val))/(Variance*Val(4));%skewness 602 Val(6)=(sum(x.*x.*x.*x.*pdf_val))/(Variance*Variance);%kurtosis 603 cumpdf=cumsum(pdf_val);% sum of pdf 604 ind_centile=find(cumpdf>=0.01,1);% first index with cumsum >=0.01 605 Val(8)=x(ind_centile)+Val(2)/2;% 606 if ind_centile>1 607 Val(8)=(cumpdf(ind_centile)-0.01)*x(ind_centile-1)+(0.01-cumpdf(ind_centile-1))*x(ind_centile); 608 Val(8)=Val(8)/(cumpdf(ind_centile)-cumpdf(ind_centile-1))+Val(2)/2;%linear interpolation near ind_centile 609 end 610 ind_decile=find(cumpdf>=0.1,1); 611 if ind_decile>1 612 Val(9)=x(ind_decile)+Val(2)/2;% 613 Val(9)=(cumpdf(ind_decile)-0.1)*x(ind_decile-1)+(0.1-cumpdf(ind_decile-1))*x(ind_decile); 614 Val(9)=Val(9)/(cumpdf(ind_decile)-cumpdf(ind_decile-1))+Val(2)/2;%linear interpolation near ind_decile; 615 end 616 ind_median=find(cumpdf>= 0.5,1); 617 Val(10)=(cumpdf(ind_median)-0.5)*x(ind_median-1)+(0.5-cumpdf(ind_median-1))*x(ind_median); 618 Val(10)=Val(10)/(cumpdf(ind_median)-cumpdf(ind_median-1))+Val(2)/2;%linear interpolation near ind_median; 619 % Val(9)=x(ind_median); 620 ind_decile=find(cumpdf>=0.9,1); 621 Val(11)=(cumpdf(ind_decile)-0.9)*x(ind_decile-1)+(0.9-cumpdf(ind_decile-1))*x(ind_decile); 622 Val(11)=Val(11)/(cumpdf(ind_decile)-cumpdf(ind_decile-1))+Val(2)/2;%linear interpolation near ind_median; 623 ind_centile=find(cumpdf>=0.99,1); 624 Val(12)=(cumpdf(ind_centile)-0.99)*x(ind_centile-1)+(0.99-cumpdf(ind_centile-1))*x(ind_centile); 625 Val(12)=Val(12)/(cumpdf(ind_centile)-cumpdf(ind_centile-1))+Val(2)/2;%linear interpolation near ind_centile; 589 590 Val=pdf2stat(x',pdf_val'); 591 626 592 Column=mat2cell(Val,ones(13,1),1); 627 593 Column=[{VarName};Column(1:6);{'stat: --'};Column(7:13)]; … … 632 598 disp(TableData); 633 599 PlotParamOut.TableDisplay=TableData; 634 % PlotParamOut.CheckTable=1;635 % htable=findobj(hfig,'Tag','TableDisplay');636 % set(htable,'Data',TableData)637 % set(htable,'Visible','on')638 % drawnow639 600 else 640 601 if isfield(PlotParamOut,'TableDisplay')
Note: See TracChangeset
for help on using the changeset viewer.