📄 s_plot_wavelet_with_spectrum.m
字号:
function aux=s_plot_wavelet_with_spectrum(wavelet,varargin)% Plot wavelet and its amplitude spectrum in one figure%% Written by: E. R.: June 5, 2004% Last updated: March 26, 2007: add 'single' option%% aux=s_plot_wavelet_with_spectrum(wavelet,varargin)% INPUT% wavelet wavelet% varargin one or more cell arrays; the first element of each cell array% is a keyword, the other elements are parameters. % Presently, keywords are:% 'average' Option to plot spectra of multiple traces individually or% average them.% Default: {'average','no'}% 'frequencies' start and end frequency to display; either two values or % a vector of two values.% Default: {'frequencies',0,500/seismic.step}% 'normalize' Establish if the amplitude spectrum is to be normalized.% Possible values are: % 'amplitude' scale data so that the mean spectral amplitude is % the same% 'peak' scale spectra so that their peaks are the same% 'power' scale spectra so that the area under the power spectrum% is the same for all signals.% 'no' do not scale spectra % Default: {'normalize','power'}% 'orient' Figure orientation; possible values are "portrait' and% 'landscape'% Default: {orient','portrait'}% 'scale' Set linear (amplitude), power, or logarithmic scale (dB) % for amplitude spectrum.% Possible values: 'linear', 'log'. % Default: {'scale','linear'}% 'times' start and end time to display (the spectrum is computed% from all the samples of the dataset); either two values or % a vector of two values.% Default: {'times',wavelet.first,wavelet.last} which is the same as% {'times',[wavelet.first,wavelet.last]}% OUTPUT% aux structure with handles% 'figure_handle' figure handles% 'axis_handles' vector with handles of the two axes% 'legend_handle' handle of the legend of the spectrum subplot%% EXAMPLE% wavelet=s_create_wavelet;% s_plot_wavelet_with_spectrum(wavelet) % aux=s_plot_wavelet_with_spectrum(wavelet,{'frequencies',0,90}, ...% {'orient','landscape'},{'normalize','no'},{'scale','log'});% Set defaults for input argumentsparam.average='no';param.frequencies=[0,500/wavelet.step];param.normalize='power';param.orient='portrait';param.scale='linear';param.single=''; % Deprecatedparam.times=[wavelet.first,wavelet.last];% Replace default input arguments by actual onesparam=assign_input(param,varargin);% Handle legacy parameterif ~isempty(param.single) alert('Parameter "single" is obsolete: please use parameter "average" instead.') param.average=~isyes(param.single);end if iscell(param.frequencies) param.frequencies=cell2num(param.frequencies);endif iscell(param.times) param.times=cell2num(param.times);endif strcmp(param.orient,'portrait') figure_handle=pfigure; haxis1=subplot(2,1,1); haxis2=subplot(2,1,2);else figure_handle=lfigure; axis off rect1=[0.09, 0.12, 0.20, 0.70]; haxis1=axes('position',rect1); rect2=[0.39, 0.12, 0.55, 0.70]; haxis2=axes('position',rect2);endaxes(haxis1)s_wplot(wavelet,{'figure','old'},{'orient','portrait'},{'times',param.times},{'deflection',0.9})title(mnem2tex(wavelet.name))ylabel('Time (ms)')axes(haxis2)s_spectrum(wavelet,{'figure','old'}, ... {'frequencies',param.frequencies(1),param.frequencies(2)}, ... {'normalize',param.normalize},{'scale',param.scale}, ... {'average',param.average},{'linewidth',3})axis tightlegend_handle=legend(wavelet.name);mytitle('Spectrum')% figure_export_menu(figure_handle)zoom onif nargout > 0 aux.figure_handle=figure_handle; aux.axis_handles=[haxis1,haxis2]; aux.legend_handle=legend_handle;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -