⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plot_modwt_coef2.m

📁 时间序列分析中很用的源码,书的原名为时间序列分析的小波方法.
💻 M
📖 第 1 页 / 共 2 页
字号:
function [hXplotAxes, hWplotAxes] = plot_modwt_coef2(WJt, VJ0t, X, w_att, ...                                                  title_str, xaxis, xlabel_str, ...                                                  WplotAxesProp, XplotAxesProp, ...                                                  J0, level_range, plotOpts, ...                                                  masterPlotFrame, xaxis_range, scale_str)% plot_modwt_coef2 -- Plot the MODWT wavelet and scaling coefficients and the original time series (individual subplots version).%%****f* wmtsa.dwt/plot_modwt_coef2%% NAME%   plot_modwt_coef2 -- Plot the MODWT wavelet and scaling coefficients and the %                     original time series (individual subplots version).% SYNOPSIS%   [hWplotAxes, hXplotAxes] = plot_modwt_coef2(WJt, VJ0t, [X], w_att, ... %                                   [title_str], [xaxis], [xlabel_str], ...%                                   [WplotAxesProp], [XplotAxesProp], ...%                                   [J0], [level_range], [plotOpts], ...%                                   [masterPlotFrame], [xaxis_range], [scale_str])%   [hWplotAxes, hXplotAxes] = plot_modwt_coef2(WJt,   [], [X], w_att, ...%                                   [title_str], [xaxis], [xlabel_str], ...%                                   [WplotAxesProp], [XplotAxesProp], ...%                                   [J0], [level_range], [plotOpts], ...%                                   [masterPlotFrame], [xaxis_range], [scale_str])%   [hWplotAxes, hXplotAxes] = plot_modwt_coef2([],  VJ0t, [X], w_att, ...%                                   [title_str], [xaxis], [xlabel_str], ...%                                   [WplotAxesProp], [XplotAxesProp], ...%                                   [J0], [level_range], [plotOpts], ...%                                   [masterPlotFrame], [xaxis_range], [scale_str])%% INPUTS%   WJt           =  NxJ array of MODWT wavelet coefficents%                    where N = number of time intervals,%                          J = number of levels%   VJ0t          =  Nx1 vector of MODWT scaling coefficients at level J0.%   X             =  (optional) vector of observations of size N.%   * w_att        -- MODWT transform attributes (struct).%   title_str     =  (optional) character string or cell array of strings containing title of plot.%   xaxis         =  (optional) vector of values to use for plotting x-axis.%   xlabel_str    =  (optional) character string or cell array of strings containing label x-axis.%   WplotAxesProp =  (optional) structure containing axes property values to%                    override for W subplot.%   XplotAxesProp =  (optional) structure containing axes property values to%                    override for X subplot.%   J0            =  (optional) override value of J0, if J ~= J0 or%                    if max(level_range) ~= J0.%   level_range   =  (optional) number or range of numbers indicating subset of%                    levels (j's) to plot.%   plotOpts      =  (optional) structure containing plot options.%   masterPlotFrame = (optional) structure containing coordinates to %                     place X and W plots.%   xaxis_range   =  (optional) range of xaxis values to plot.%   scale_str     =  (optional) character cell array of strings containing%                    physcial scale values of levels to label left y-axis of W plot.%% OUTPUTS%   hWplotAxes    =  (optional) handle to axes for MODWT coefficients (W) subplot.%   hXplotAxes    =  (optional) handle to axes for original data series (X) subplot.%% SIDE EFFECTS%   1. If plotting VJ0t, without WJt (i.e. WJt = []), must specify a value for%      J0; otherwise error.%   2. If a level_range is specified, must provide a value for J0; otherwise%      error.%   3. Either WJt or VJ0t,  or both WJt and VJ0t may be specified'; otherwise%      error.%% DESCRIPTION%   plot_modwt_coef plots the MODWT coefficients and optionally the original%   data series, each as indivual subplots.  It is similar to plot_modwt_coef%   but differs in that thate wavelet coefficeints at each level and scaling %   coefficients at J0 level are plotted on their individual plot axes.%   By default, the Y-axis of each level is scaled to min and max values%   of the coefficients at that level.%%   Either or both the MODWT wavelet and scaling coefficients%   may be plotted.  The MODWT coefficients are circularly shifted at each%   level so as to properly align the coefficients with the original data%   data series.%%   By default, the wavelet coefficients (WJt) and scaling coefficient at%   level J0 (VJ0t) are plotted.  A subrange of wavelet coefficient levels%   may be specified by via the parameter, level_range = [lower:upper]%%   By default, the boundaries demarcing the circularly shifted MODWT%   coefficients influenced by the circularity conditions are plot.  %   Plotting of the boundaries may be toggled off.%%   By default, the mean value of VJ0t is subtracted from VJ0t, so that%   when plotting a data series with large mean offsets, the VJ0t level%   does not dominate the Wplot.%%   Defaults for plotOpts:%     plotOpts.PlotMODWTBoundary = 1;%     plotOpts.PlotWJt = 1;%     plotOpts.PlotVJ0t = 1;%     plotOpts.PlotX = 1;%     plotOpts.SubtractMeanVJ0t = 1;%% EXAMPLE%    [WJt, VJ0t] = modwt(X, 'la8', 10, 'reflection');%    plot_modwt_coef(WJt, VJ0t, X, 'la8');%% NOTES%%% TODO%    Plotting of MODWT Boundaries is not currently implement.%% REFERENCES%%% SEE ALSO%   plot_modwt_coef, modwt, modwt_filter, overplot_modwt_cir_shift_coef_bdry,%% AUTHOR%   Charlie Cornish%% CREATION DATE%   2004/02/17%% COPYRIGHT%%% CREDITS%%% REVISION%   $Revision: 612 $%%***% $Id: plot_modwt_coef2.m 612 2005-10-28 21:42:24Z ccornish $% Initialize constants and other parametersylabel_xoffset = .015;% Master Plot Frame - contains all subplotdefault_masterPlotFrame.left = .15;default_masterPlotFrame.bottom = .11;default_masterPlotFrame.width = .775;default_masterPlotFrame.height = .805;default_masterPlotFrame.subplot_yspacing = .010;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   Check Input Arguments%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if nargerr(mfilename, nargin, [1:15], nargout, [0:2])  error_str = ['Usage:  [hWplotAxes, hXplotAxes] = ', mfilename, ...               '(WJt, VJ0t, [X], w_att' ...               ', [title_str], [xaxis], [xaxis_label]', ...               ', [WplotAxesProp], [XplotAxesProp]' ...               ', [J0], [level_range], [plotOpts], ', ...               ', [masterPlotFrame], [xaxis_range], [scale_str])'];  error(error_str);endif (~exist('w_att', 'var') || isempty(w_att) )  error('Must specify the MODWT attribute structure.');end  wtfname = w_att.WTF;NX  = w_att.NX;N = NX;NW = w_att.NW;J0 = w_att.J0;boundary = w_att.Boundary;%% Get a valid wavelet transform filter coefficients struct.if (ischar(wtfname))  try    [wtf_s] = modwt_filter(wtfname);  catch    rethrow(lasterror);  endelse  error('WMTSA:invalidWaveletTransformFilter', ...        encode_errmsg('WMTSA:invalidWaveletTransformFilter', wmtsa_err_table, 'wtf'));end  wtfname = wtf_s.Name;g = wtf_s.g;h = wtf_s.h;L = wtf_s.L;% Initialize and set the plot optionsplot_WJt = 0;plot_VJ0t = 0;plot_X = 0;plot_modwt_boundary = 1;subtract_mean_VJ0t = 1;if (exist('WJt', 'var') && ~isempty(WJt) )  plot_WJt = 1;end  if (exist('VJ0t', 'var') && ~isempty(VJ0t) )  plot_VJ0t = 1;endif (exist('X', 'var') && ~isempty(X) )  plot_X = 1;endif (~exist('plotOpts', 'var'))  plotOpts = [];endif (isfield(plotOpts, 'PlotWJt'))  if (plotOpts.PlotWJt)    plot_WJt = 1;  else    plot_WJt = 0;  endendif (isfield(plotOpts, 'PlotVJ0t'))  if (plotOpts.PlotVJ0t)    plot_VJ0t = 1;  else    plot_VJ0t = 0;  endendif (isfield(plotOpts, 'PlotX'))  if (plotOpts.PlotX)    plot_X = 1;  else    plot_X = 0;  endendif (plot_WJt == 0 && plot_VJ0t == 0)  error('Must specify either WJt or VJ0t, or both for plotting');endif (isfield(plotOpts, 'PlotMODWTBoundary'))  if (plotOpts.PlotMODWTBoundary)    plot_modwt_boundary = 1;  else    plot_modwt_boundary = 0;  end    endif (isfield(plotOpts, 'SubtractMeanVJ0t'))  if (plotOpts.SubtractMeanVJ0t)    subtract_mean_VJ0t = 1;  else    subtract_mean_VJ0t = 0;  end    endif (~exist('level_range', 'var') || isempty(level_range))  level_range = [];else  if (argterr(mfilename, level_range, 'int') ~= 0)    error(['level_range must be int']);  endend% Initialized and override masterPlotFrameif (~exist('masterPlotFrame', 'var') || isempty(masterPlotFrame))  masterPlotFrame = default_masterPlotFrame;else  if (~isfield(masterPlotFrame, 'left'))    masterPlotFrame.left = default_masterPlotFrame.left;  end  if (~isfield(masterPlotFrame, 'bottom'))    masterPlotFrame.bottom = default_masterPlotFrame.bottom;  end  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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -