图3-4 滤波效果仿真波形
而如果加入的谐波次数不为三的奇数倍时则滤除后的波形通过图3-5可以得出结论。
图3-5 滤波效果仿真波形
通过这种方法可以直观的看出信号频率中含有多少次谐波,而滤波器能滤除多少次谐波。
用MATLAB设计M文件如下:
第三章 基于MATLAB的仿真设计
f=linspace(0,6*pi,500); b1=cos(f*pi/N*k); H1=abs(b1); plot(f,H1)
xlabel('f/f1');ylabel('H1'); grid on
运行这个M程序单击,可以得到滤波器的幅频特性如图3-6所示。
图3-6 滤波器的幅频特性
改变界面中的采样频率和步长,同样可以得出相应的波形图。
3.4 两种滤波器的比较及应用
通过观察波形图可以看出,当选择K值后,差分滤波器能滤除m次及m的整倍数次谐波。当m=1时(K=N),能消除基波及各次谐波(包括直流),若输入信号中含有直流、基波及基波的整倍数次谐波,则在稳态输入时,滤波器的输出为0。这一特点在保护中常被用作增量元件。
在电力系统正常时或故障进入稳态后,滤波器的输出为0,在故障后的KTs
时间内,滤波器有输出,此时输出的是故障后的参数与故障前的负荷参数之差,这就是故障分量。
当采用差分滤波器滤除短路电流中的谐波分量时,必须在短路发生后,经过KTs的时间才开始正确反映短路后的电流,在此之前,X(nTs-KTs)反映的是短路前的状态。因此,该滤波器有KTs的延时,K值越大(Ts已定),延时越长,即数据窗延时越长。故在选择滤波器时,在保证滤波效果的同时,应尽量减小数据窗长度。差分滤波器只需做减法,因此算法简单,运算工作量小。
在变电站综合自动化系统中,差分滤波器主要用于:
(1)抑制故障信号中的衰减直流分量的影响。差分滤波器的突出优点之一是完全滤除输入信号中的恒定直流分量,同时,对于衰减的直流分量也有良好的抑制作用。为减少算法的数据窗,加快计算速度通常K=1。
但需要指出的是,图中差分滤波器的幅频特性差分滤波器对故障信号中的某些高频分量有一定的放大作用。因此,一般不能单独使用,需于其他如傅氏算法相配合,以保证在故障信号中同时含有衰减直流分量和其他高频分量时,仍具有良好的综合滤波效果。
(2)提取故障信号中的故障分量。
当m=1时(K=N),能消除基波及各次谐波(包括直流),若输入信号中含有直流、基波及基波的整倍数次谐波,则在稳态输入时,滤波器的输出为0。这一特点在保护中常被用作增量元件。
在电力系统正常时或故障进入稳态后,滤波器的输出为0,在故障后的KTs时间内,滤波器有输出,此时输出的是故障后的参数与故障前的负荷参数之差,这就是故障分量。
加法滤波器有如下特点:
(1)与差分滤波器比较,数据窗短,为差分滤波器的一半。
(2)因是前后两个采样值相加,故不能消除直流分量,这是它的一大缺点 (3)加法滤波器只进行加法运算,故简单,工作量小。
第三章 基于MATLAB的仿真设计
附录 差分滤波器程序
function varargout = m(varargin) % M MATLAB code for m.fig
% M, by itself, creates a new M or raises the existing % singleton*. %
% H = M returns the handle to a new M or the handle to
% the existing singleton*.
% %
M('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in M.M with the given input arguments. %
% M('Property','Value',...) creates a new M or raises the
% existing singleton*. Starting from the left, property value pairs are % applied to the GUI before m_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application % stop. All inputs are passed to m_OpeningFcn via varargin. %
% *See GUI Options on GUIDE's Tools menu. Choose \one
% instance to run (singleton)\ %
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the
response to help m
% Last Modified by GUIDE v2.5 13-Jun-2012 02:13:31
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @m_OpeningFcn, ...
'gui_OutputFcn', @m_OutputFcn, ...
'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end
if nargout
[varargout{1:nargout}] =
gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before m is made visible.
function m_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to m (see VARARGIN)
% Choose default command line output for m
handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes m wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout =
m_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)