📄 iff.m
字号:
function ry=iff(x,y)
% Interactive Fourier Filter function for data in arguments x,y,
% with sliders for interactive control of the center frequency,
% width, and shape of the filter. Shape determines the sharpness
% of the cut-off. If shape =1, the filter is Gaussian; as shape
% increases the filter shape becomes more and more rectangular.
% mode=0 for band-pass filter, linear plot; mode=1 for band-pass filter,
% semilogx plot; mode=2 for band-reject (notch) filter, linear plot;
% mode=3 for band-reject (notch) filter, semilogx plot.
% In this version, the original and filtered signals are
% displayed in separate windows. To display the original
% signal and filtered signal superimposed in the same window,
% rename AlternativeRedrawFourierFilter.m to RedrawFourierFilter.m
% T. C. O'Haver (toh@umd.edu), version 1.4, October 29, 2006
global center
global width
global shape
global mode
global ry
close
signalstring='Original signal';
% Adjust x and y vector shape to 1 x n (rather than n x 1)
x=reshape(x,1,length(x));
y=reshape(y,1,length(y));
% Initial values of filter parameters
center=1;
width=40;
shape=2;
mode=0; % mode=0 for band-pass filter, mode=1 for band-reject (notch) filter
% Plot the signal and its power spectrum
ry=RedrawFourierFilter(x,y,center,width,shape,mode);
h=figure(1);
h2=gca;
% Maximum ranges of the sliders (change as needed)
MaxCenter=(length(x)/2)-1;
MaxWidth=length(x);
MaxShape=20;
% Draw the sliders
rtslid(h,@iffcenter,h2,1,'Scale',[0 MaxCenter],'Def',center,'Back',[0.9 0.9 0.9],'Label','Center','Position',[0.03 0.24 0.03 0.68]);
rtslid(h,@iffmode,h2,0,'Scale',[0 3],'Def',.1,'Back',[0.9 0.9 0.9],'Label','Mode','Position',[0.03 0.05 0.03 0.1]);
rtslid(h,@iffwidth,h2,0,'Scale',[1 MaxWidth],'Def',width,'Back',[0.9 0.9 0.9],'Label','Width','Position',[0.95 0.24 0.03 0.68]);
rtslid(h,@iffshape,h2,0,'Scale',[1 MaxShape],'Def',shape,'Back',[0.9 0.9 0.9],'Label','Shape','Position',[0.95 0.05 0.03 0.1]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -