function varargout = butterworth_real(varargin)
% BUTTERWORTH_REAL Application M-file for butterworth_real.fig
% FIG = BUTTERWORTH_REAL launch butterworth_real GUI.
% BUTTERWORTH_REAL('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.0 06-Sep-2005 10:57:39
if nargin == 0 % LAUNCH GUI
fig = openfig(mfilename,'reuse');
% Use system color scheme for figure:
set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig, handles);
if nargout > 0
varargout{1} = fig;
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
if (nargout)
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
else
feval(varargin{:}); % FEVAL switchyard
end
catch
disp(lasterr);
end
end
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
% --------------------------------------------------------------------
function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)
close all;
index2;
% --------------------------------------------------------------------
function varargout = pushbutton3_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = plot_button_Callback(h, eventdata, handles, varargin)
global select_signal;
global t;
% Calculate data
y = fft(select_signal,512);
m = y.*conj(y)/512;
a = angle(y);
f = 1000*(0:256)/512;
% Create time plot
axes(handles.time_axes)
plot(t,select_signal)
ylabel('Time-domain')
set(handles.time_axes,'XMinorTick','on')
grid on
% Create magnitude plot
axes(handles.magnitude_axes)
plot(f,m(1:257))
ylabel('Magnitude');
set(handles.magnitude_axes,'XMinorTick','on')
grid on
% Create phase plot
axes(handles.phase_axes)
plot(f,a(1:257))
ylabel('Phase(degree)');
set(handles.phase_axes,'XMinorTick','on')
grid on
% --------------------------------------------------------------------
function varargout = time_axes_CreateFcn(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = plot_button_CreateFcn(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = pushbutton2_CreateFcn(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = plot_button2_Callback(h, eventdata, handles, varargin)
global select_signal;
global t;
ord=str2double(get(handles.order_input,'String'));
wl=str2double(get(handles.w1_input,'String'));
wh=str2double(get(handles.w2_input,'String'));
sa=str2double(get(handles.sample_input,'String'));
global select_signal;
global t;
ord=str2double(get(handles.order_input,'String'));
w1=str2double(get(handles.w1_input,'String'));
w2=str2double(get(handles.w2_input,'String'));
sa=str2double(get(handles.sample_input,'String'));
val = get(handles.pop_menu,'Value');
switch val;
case 1
N=ord;
Wn=w2/(sa/2);
[b,a]=butter(N,Wn,'high');
figure(1)
freqz(b,a,sa);
figure(2)
[h,tr]=impz(b,a,101);
stem(tr,h)
grid on
yfilt=filter(b,a,select_signal);
% Calculate data
yy = fft(yfilt,512);
mm = yy.*conj(yy)/512;
aa = angle(yy);
ff = 1000*(0:256)/512;
% Create time plot
axes(handles.filter_axes1)
plot(t,yfilt)
set(handles.time_axes,'XMinorTick','on')
grid on
% Create magnitude plot
axes(handles.filter_axes2)
plot(ff,mm(1:257))
set(handles.magnitude_axes,'XMinorTick','on')
grid on
% Create phase plot
axes(handles.filter_axes3)
plot(ff,aa(1:257))
set(handles.phase_axes,'XMinorTick','on')
grid on
case 2
N=ord;
Wn=[w1 w2]/(sa/2);
[b,a]=butter(N,Wn,'bandpass');
figure(1)
freqz(b,a,sa);
figure(2)
[h,tr]=impz(b,a,101);
stem(tr,h)
grid on
yfilt=filter(b,a,select_signal);
% Calculate data
yy = fft(yfilt,512);
mm = yy.*conj(yy)/512;
aa = angle(yy);
ff = 1000*(0:256)/512;
% Create time plot
axes(handles.filter_axes1)
plot(t,yfilt)
set(handles.time_axes,'XMinorTick','on')
grid on
% Create magnitude plot
axes(handles.filter_axes2)
plot(ff,mm(1:257))
set(handles.magnitude_axes,'XMinorTick','on')
grid on
% Create phase plot
axes(handles.filter_axes3)
plot(ff,aa(1:257))
set(handles.phase_axes,'XMinorTick','on')
grid on
case 3
N=ord;
Wn=[w1 w2]/(sa/2);
[b,a]=butter(N,Wn,'stop');
figure(1)
freqz(b,a,sa);
figure(2)
[h,tr]=impz(b,a,101);
stem(tr,h)
grid on
yfilt=filter(b,a,select_signal);
% Calculate data
yy = fft(yfilt,512);
mm = yy.*conj(yy)/512;
aa = angle(yy);
ff = 1000*(0:256)/512;
% Create time plot
axes(handles.filter_axes1)
plot(t,yfilt)
set(handles.time_axes,'XMinorTick','on')
grid on
% Create magnitude plot
axes(handles.filter_axes2)
plot(ff,mm(1:257))
set(handles.magnitude_axes,'XMinorTick','on')
grid on
% Create phase plot
axes(handles.filter_axes3)
plot(ff,aa(1:257))
set(handles.phase_axes,'XMinorTick','on')
grid on
case 4
N=ord;
Wn=w1/(sa/2);
[b,a]=butter(N,Wn,'low');
figure(1)
freqz(b,a,sa);
figure(2)
[h,tr]=impz(b,a,101);
stem(tr,h)
grid on
yfilt=filter(b,a,select_signal);
% Calculate data
yy = fft(yfilt,512);
mm = yy.*conj(yy)/512;
aa = angle(yy);
ff = 1000*(0:256)/512;
% Create time plot
axes(handles.filter_axes1)
plot(t,yfilt)
set(handles.time_axes,'XMinorTick','on')
grid on
% Create magnitude plot
axes(handles.filter_axes2)
plot(ff,mm(1:257))
set(handles.magnitude_axes,'XMinorTick','on')
grid on
% Create phase plot
axes(handles.filter_axes3)
plot(ff,aa(1:257))
set(handles.phase_axes,'XMinorTick','on')
grid on
end
% --------------------------------------------------------------------
function varargout = w1_input_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = w2_input_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = sample_input_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = order_input_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = popupmenu1_Callback(h,
xinhaochuli.rar_The Signal
版权申诉
61 浏览量
2022-09-14
22:47:49
上传
评论
收藏 89KB RAR 举报
朱moyimi
- 粉丝: 64
- 资源: 1万+
最新资源
- 5.23-Java概述,JDK安装及注释、关键字、标识符、数据类型、变量、常量的介绍
- 《Python基础》实验三指导书(1).doc
- TensorFlow 深度学习、机器学习-任何能够用计算流图形来表达的计算,都可以使用TensorFlow
- 2024最新学成在线网页实战项目代码
- 一个基于springboot+sureness的面向REST API资源无状态认证权限管理系统
- 王博外文文献.pdf
- python毕业设计基于社区检测的多任务聚类联邦学习项目源码+使用说明(高分项目).zip
- Javaweb项目源码-编程爱好者博客地带.zip
- java各个技术栈相关知识点
- PYthon代码 pdf合并
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈