?? chevyshev_i_stopband.asv
字號(hào):
function varargout = CHEVYSHEV_I_stopband(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CHEVYSHEV_I_stopband_OpeningFcn, ...
'gui_OutputFcn', @CHEVYSHEV_I_stopband_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 CHEVYSHEV_I_stopband is made visible.
function CHEVYSHEV_I_stopband_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 CHEVYSHEV_I_stopband (see VARARGIN)
% Choose default command line output for CHEVYSHEV_I_stopband
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CHEVYSHEV_I_stopband wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = CHEVYSHEV_I_stopband_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 during object creation, after setting all properties.
function muestreo_CreateFcn(hObject, eventdata, handles)
% hObject handle to muestreo (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 menu.
function menu_Callback(hObject, eventdata, handles)
% hObject handle to menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
FILTER
close CHEVYSHEV_I_stopband
% --- 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.muestreo,'String'));
Fpb=str2double(get(handles.b_pb,'String'));
Fpb1=str2double(get(handles.dos0,'String'));
Fsb=str2double(get(handles.b_rb,'String'));
Fsb1=str2double(get(handles.dos1,'String'));
Rpb=str2double(get(handles.edit4,'String'));
Rsb=str2double(get(handles.edit5,'String'));
fs=Fs/2; %Frec. de muestreo
fpb=[Fpb Fpb1]/fs; %Frec. de borde pasa banda
fpb
fsb=[Fsb Fsb1]/fs; % Frec. de borde rechaza banda
fsb
%------------------------------------------------------------
[n,wn]=cheb1ord(fpb, fsb, Rpb, Rsb);
[b,a] =cheby1(n,wn,'stop');
[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 stopband, Respuesta en magnitud, orden=', num2str(n)]);
xlabel('frecuencia');
ylabel('H(f) db')
axis([0 0.5 -Rsb-10 0])
axes(handles.axes2)
plot(w,angle(H));
grid on;
title (['Filtro stopband, Respuesta en magnitud, orden=', num2str(n)]);
xlabel('frecuencia')
ylabel('醤gulo de H rad')
%Resp al impulso
axes(handles.axes3)
[y,t]= impz(b,a,60);
stem(t,y);
title (['Filtro stopband, Respuesta al impulso, orden=', num2str(n)]);
%Ploteo de los polos y ceros
z= roots(b); %Zeros
p = roots(a); % Polos
axes(handles.axes4)
zplane(z,p)
title(['Trazade polos y ceros'])
function dos0_Callback(hObject, eventdata, handles)
% hObject handle to dos0 (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 dos0 as text
% str2double(get(hObject,'String')) returns contents of dos0 as a double
% --- Executes during object creation, after setting all properties.
function dos0_CreateFcn(hObject, eventdata, handles)
% hObject handle to dos0 (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
function dos1_Callback(hObject, eventdata, handles)
% hObject handle to dos1 (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 dos1 as text
% str2double(get(hObject,'String')) returns contents of dos1 as a double
% --- Executes during object creation, after setting all properties.
function dos1_CreateFcn(hObject, eventdata, handles)
% hObject handle to dos1 (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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -