attributes.m

来自「这是matlab在地球物理数据处理方面的源码」· M 代码 · 共 44 行

M
44
字号
function [envelope,instphi,instfreq] = attributes(traces,t)% function attributes - calculates the amplitude envelope, the instantaneous phase,% and the instantaneous frequency for a set of seismic traces% The program uses the Matlab Hilbert transform function.% The envelope is simply the absolute value of the output of the Hilbert transform.% That is, the real part is the input function and the imaginary part is its Hilbert% transform. The Hilbert transform produces the 90 degree phase shifted version of% the input trace.% The instantaneous phase is simply the angle(unwrap(hilbert(traces))) and the% instantaneous phase is the derivative of this function with respect to time.% The instantaneous frequency is not really a frequency but has the same units of% frequency.delt  = t(2) - t(1);[m,n] = size(traces);temp = hilbert(traces);  % Note that traces must be in column formatinstphi = unwrap(angle(temp));envelope = abs(temp);temp = diff(instphi)/delt;  fil = [0.2 0.2 0.2 0.2 0.2]; % For smoothingfor i = 1:n   instfreq(:,i) = conv(fil,temp(:,i)); % Smoothed derivativeendfiguresubplot(1,2,1)imagesc(1:n,t,traces);title('original traces')ylabel('time (seconds)')subplot(1,2,2)imagesc(1:n,t,envelope)title('Amplitude Envelope')colorbarfiguresubplot(1,2,1)imagesc(1:n,t,instphi)title('Instantanteous Phase')subplot(1,2,2)imagesc(1:n,t,instfreq)colorbarreturn;

⌨️ 快捷键说明

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