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

📄 butterwoth_bp.m

📁 数字滤波仿真程序
💻 M
字号:
function varargout = Butterwoth_BP(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Butterwoth_BP_OpeningFcn, ...
                   'gui_OutputFcn',  @Butterwoth_BP_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 Butterwoth_BP is made visible.
function Butterwoth_BP_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 Butterwoth_BP (see VARARGIN)

% Choose default command line output for Butterwoth_BP
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Butterwoth_BP wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Butterwoth_BP_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;





% --- Executes on button press in calcular.
function calcular_Callback(hObject, eventdata, handles)
% hObject    handle to calcular (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
Fs=str2double(get(handles.Fs,'String'));
Fpb1=str2double(get(handles.fpb1,'String'));
Fpb2=str2double(get(handles.fpb2,'String'));
Rp=str2double(get(handles.Rp,'String'));
n=str2double(get(handles.orden,'String'));

fs=Fs/2;    %Frec. de muestreo
fpb1=Fpb1/fs;  %Frec. de borde pasa banda

fpb2=Fpb2/fs; % Frec. de borde rechaza banda


wn=[fpb1,fpb2];
[b,a]=butter(n,wn);
[H,w]=freqz(b,a,512,1);


%------------------------------------------------------------

%Trazado de la respuesta en Magnitud

axes(handles.axes1)
plot(w,20*log10(abs(H)));
grid on;
title (['Filtro bandpass, Respuesta en magnitud, orden=', num2str(n)]);
xlabel('frecuencia');
ylabel('H(f) db')
axis([0 0.5 -100 0])


axes(handles.axes2)
plot(w,angle(H));
grid on;
title (['Filtro bandpass, Respuesta en magnitud, orden=', num2str(n)]);
xlabel('frecuencia')
ylabel('醤gulo de H rad')

%Resp al impulso

[y,t]= impz(b,a,60);

stem(t,y);
title (['Filtro bandpass, Respuesta al impulso, orden=', num2str(n)]);

%Ploteo de los polos y ceros

z= roots(b);  %Zeros
p = roots(a);  % Polos

axes(handles.axes3)
zplane(z,p)
title(['Trazade polos y ceros'])

⌨️ 快捷键说明

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