?? plot_modwt_coef.m
字號:
if (~isfield(masterPlotFrame, 'width')) masterPlotFrame.width = default_masterPlotFrame.width; end if (~isfield(masterPlotFrame, 'height')) masterPlotFrame.height = default_masterPlotFrame.height; end if (~isfield(masterPlotFrame, 'wsubplot_yspacing')) masterPlotFrame.subplot_yspacing = default_masterPlotFrame.subplot_yspacing; endendif (~exist('scale_str', 'var') || isempty(scale_str)) scale_str = [];end% Initial default values for the W (coefficients) plot frame.WplotFrame.left = masterPlotFrame.left;WplotFrame.bottom = masterPlotFrame.bottom;WplotFrame.width = masterPlotFrame.width;WplotFrame.height = masterPlotFrame.height; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Transform data for plotting%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%W = [];Wlabels = {};jj = 0;if (plot_WJt) if(~exist('level_range', 'var') || isempty(level_range)) level_range = 1:J0; end for (j = level_range) jj = jj + 1; nuHj = advance_wavelet_filter(wtfname, j); W(:,jj) = circshift(WJt(:,j), nuHj); Wlabels{jj} = ['T^{', int2str(nuHj), '}\bfW\rm_{', int2str(j), '}']; endendif (plot_VJ0t) jj = jj + 1; nuGj = advance_scaling_filter(wtfname, J0); if (subtract_mean_VJ0t) VJ0t = VJ0t - mean(VJ0t); label_str = ['T^{', int2str(nuGj), ... '}\bfV\rm_{', int2str(J0), '}\prime']; else label_str = ['T^{', int2str(nuGj), '}\bfV\rm_{', int2str(J0), '}']; end W(:,jj) = circshift(VJ0t, nuGj); Wlabels{jj} = label_str;end%% Truncate for reflection BC's, where NW = 2 * N;W = W(1:N,:,:);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Setup up x-axis%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% If xaxis is not specified, use the sample pointsif (~exist('xaxis', 'var') || isempty(xaxis)) xaxis = (1:N);endif (exist('xaxis_range', 'var') && ~isempty(xaxis_range)) indices = find(xaxis >= xaxis_range(1) & xaxis <= xaxis_range(end)); xaxis = xaxis(indices); W = W(indices,:); if (plot_X) X = X(indices,1); endelse xaxis_range = [];endxaxis_xmin = min(xaxis);xaxis_xmax = max(xaxis);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parse the Xplot options%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (plot_X) % Check that length(X) == length(W) if (length(X) ~= length(W)) error(['Length of X must be equal nrows of WJt and VJ0t']); end % Initialize default values Xmin = min(X); Xmax = max(X); XplotAxesPropName = {}; XplotAxesPropVal = {}; if (exist('XplotAxesProp', 'var') && ~isempty(XplotAxesProp)) % Overide default values for Xmin, Xmin (= YLim min and max for Xplot) if (isfield(XplotAxesProp, 'YLim')) ylim = XplotAxesProp.YLim; Xmin = ylim(1); Xmax = ylim(2); end % Populate cell arrays for Xplot axes names and properties axes_field_names = fieldnames(XplotAxesProp); nfields = length(axes_field_names); for (i = 1:nfields) fname = axes_field_names{i}; XplotAxesPropName(i) = {fname}; fval = XplotAxesProp.(fname); XplotAxesPropVal(i) = {fval}; end endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Override x-axis min, max values%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (exist('XplotAxesProp', 'var')) % Overide default values for xaxis_xmin, xaxis_xmax from XplotAxesProp if (isfield(XplotAxesProp, 'XLim')) xlim = XplotAxesProp.XLim; xaxis_xmin = xlim(1); xaxis_xmax = xlim(2); endelseif (exist('WplotAxesProp', 'var')) % Overide default values for xaxis_xmin, xaxis_xmax from WplotAxesProp if (isfield(WplotAxesProp, 'XLim')) xlim = WplotAxesProp.XLim; xaxis_xmin = xlim(1); xaxis_xmax = xlim(2); endelse % Do nothing - no overrideend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Create Xplot%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (plot_X) % In creating the subplots for X and W, scale the subplots so that X and W % are plotted on the same y scale. Wmax = max(W); Wmin = min(W); Wtotal_range = sum(abs(Wmax - Wmin)); Xtotal_range = abs(Xmax - Xmin); Yaxis_total_range = Wtotal_range + Xtotal_range; Wplot_ypercent = Wtotal_range / Yaxis_total_range; Xplot_ypercent = Xtotal_range / Yaxis_total_range; XplotFrame.height = masterPlotFrame.height * Xplot_ypercent; WplotFrame.height = masterPlotFrame.height * Wplot_ypercent; XplotFrame.left = masterPlotFrame.left; XplotFrame.bottom = masterPlotFrame.bottom; XplotFrame.width = masterPlotFrame.width; XplotPosition = [XplotFrame.left, ... XplotFrame.bottom ... XplotFrame.width, ... XplotFrame.height]; % Create a subplot for X hXplotAxes = axes('Tag', 'Xplot', ... 'Position', XplotPosition, ... 'XAxisLocation', 'bottom', ... 'YAxisLocation', 'left'); line(xaxis, X); set(gca, XplotAxesPropName, XplotAxesPropVal); set(gca, 'XLim', [xaxis_xmin xaxis_xmax]); set(gca, 'YLim', [Xmin Xmax]); xscale = (xaxis_xmax - xaxis_xmin) / masterPlotFrame.width; ylabel_xpos = xaxis_xmax + (xscale * ylabel_xoffset); if ( min(X) < 0 && max(X) > 0) ylabel_ypos = 0; else ylabel_ypos = Xmin + (Xmax - Xmin) / 2; end text(ylabel_xpos, ylabel_ypos, '\bfX', ... 'HorizontalAlignment', 'Left', ... 'VerticalAlignment', 'Middle', ... 'Tag', 'X'); if (exist('xlabel_str', 'var') && ~isempty(xlabel_str)) xlabel(xlabel_str) end WplotFrame.bottom = masterPlotFrame.bottom + XplotFrame.height + masterPlotFrame.subplot_yspacing;end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Create Wplot%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%WplotPosition = [WplotFrame.left, ... WplotFrame.bottom ... WplotFrame.width, ... WplotFrame.height];hWplotAxes = axes('Tag', 'Wplot', ... 'Position', WplotPosition);% Plot the MODWT coefficientsWplotAxesProp.XLim = [xaxis_xmin xaxis_xmax];hWplotAxes = multi_yoffset_plot(xaxis, W, Wlabels, WplotAxesProp, scale_str);% hWplotAxes = multi_yoffset_plot(xaxis, W, Wlabels, WplotAxesProp);% Turn off tick mark labeling for Wplot.set(hWplotAxes, 'YTickLabel', {});set(hWplotAxes, 'XTickLabel', {});if (~plot_X) % If no Xplot ... % - add xaxis label if string value provided if (exist('xlabel_str', 'var') && ~isempty(xlabel_str)) xlabel(xlabel_str) end % - turn on tickmark lablels if overrided. if (isfield(WplotAxesProp, 'XTickLabel')) set(hWplotAxes, 'XTickLabel', WplotAxesProp.XTickLabel); end if (isfield(WplotAxesProp, 'YTickLabel')) set(hWplotAxes, 'YTickLabel', WplotAxesProp.YTickLabel); endendif (exist('title_str', 'var') && ~isempty(title_str)) suptitle(title_str)end% TODO: For now, don't plot circular shift boundaries if xaxis_range specified% Add at later dateif (plot_modwt_boundary && isempty(xaxis_range)) overplot_modwt_cir_shift_coef_bdry(hWplotAxes, WJt, VJ0t, w_att, ... xaxis, J0, level_range);endreturn
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -