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

📄 interactivefourierfilter.m

📁 A fourier filter for time-series signals. Does not require the Signal Processing Toolbox. There is
💻 M
字号:
% Interactive Fourier Filter for a time-based signal in global
% variables x,y, with sliders for interactive control of the center 
% frequency, width, and shape of the filter. 'Center' and 'width' 
% are the center and width of the filter band expressed
% in harmonic number. '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.
% The filtered signal returned in global vector ry.
%  T. C. O'Haver (toh@umd.edu),   version 1.5, May, 2007
global x
global y
global ry
global center
global width
global shape
global mode
global signalstring

close
signalstring='';

% Create a time vector as an independent variable if you don't have one already
% defined.
% x=[0:(1/samplerate):samplingtime];

% 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
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 + -