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

📄 demoiff.asv

📁 A fourier filter for time-series signals. Does not require the Signal Processing Toolbox. There is
💻 ASV
字号:
% Self-contained demonstration of Interactive Fourier Filter
% with sliders for interactive control. The Signal slider selects from 
% five different signals (you can change these in iffsignal.m). The
% Center slider controls the center frequency of the filter, the Width  
% slider controls the width, and the Shape slider controls the shape 
% of the pass band. 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
clear
global x
global y
global ry
global center
global width
global shape
global mode
global signalstring
close

% Generate simulated signal
n=200;
x=[1:n];
signalstring='Sine wave with frequency = 1';
y=sin(2*pi.*x./n); % Simple sine wave with frequency = 1.

% Initial values of filter parameters
center=1;
width=28;
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.02 0.13 0.03 0.68]);
rtslid(h,@iffsignal,h2,0,'Scale',[1 5],'Def',1,'Back',[0.9 0.9 0.9],'Label','Signal','Position',[0.02 0.88 0.03 0.06]);
rtslid(h,@iffmode,h2,0,'Scale',[0 3],'Def',.1,'Back',[0.9 0.9 0.9],'Label','Mode','Position',[0.02 0.02 0.03 0.04]);
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 + -