Gui Code of Z Transform
Gui Code of Z Transform
Gui Code of Z Transform
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = z_domain_plot_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)
Ts = 0.1;
a0 = str2num(get(handles.Pcoeff1, 'String'));
a1 = str2num(get(handles.Pcoeff2, 'String'));
a2 = str2num(get(handles.Pcoeff3, 'String'));
a3 = str2num(get(handles.Pcoeff4, 'String'));
b0 = str2num(get(handles.Zcoeff1, 'String'));
b1 = str2num(get(handles.Zcoeff2, 'String'));
b2 = str2num(get(handles.Zcoeff3, 'String'));
b3 = str2num(get(handles.Zcoeff4, 'String'));
Zeros = zero(HZ);
Poles = pole(HZ);
set(handles.zT, 'String', num2str(Zeros, '% 2.3g'))
set(handles.pT, 'String', num2str(Poles, '% 2.3g'))
T = evalc('HZ');
set(handles.textT, 'String', T);
axes(handles.axes1)
pzplot(HZ)
axis equal
end
a0 = str2num(get(handles.Pcoeff1, 'String'));
a1 = str2num(get(handles.Pcoeff2, 'String'));
a2 = str2num(get(handles.Pcoeff3, 'String'));
a3 = str2num(get(handles.Pcoeff4, 'String'));
b0 = str2num(get(handles.Zcoeff1, 'String'));
b1 = str2num(get(handles.Zcoeff2, 'String'));
b2 = str2num(get(handles.Zcoeff3, 'String'));
b3 = str2num(get(handles.Zcoeff4, 'String'));
axes(handles.axes2)
response = impulse(HZ)*Ts;
Nvector = 0:length(response)-1;
stem(Nvector, response, 'r','linewidth', 1.2);
xlim([0 6])
grid minor
title('n VS h(n)_{Closed Form}', 'FontSize', 11)
end
else
HZ = tf(num, den, Ts, 'variable', 'z^-1');
T = evalc('HZ');
set(handles.textT, 'String', T);
axes(handles.axes2)
response = impulse(HZ)*Ts;
Nvector = 0:length(response)-1;
stem(Nvector, response, 'linewidth', 1.2);
xlim([0 100])
grid minor
title('n VS h(n)')
end
% --------------------------------------------------------------------
function Author_Callback(hObject, eventdata, handles)
% hObject handle to Author (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
msgbox(sprintf(['This product is developed by Osama Abbas,' ...
'\nCurrently a Teaching Assistant at AAST.' ...
'\nContact me: osama_abbas@student.aast.edu']), 'Author', 'Help')
% --------------------------------------------------------------------
%%
% $function common_pairs_Callback(hObject, eventdata, handles)$
% hObject handle to common_pairs (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fileName = 'Z-Transform Common Pairs.pdf';
winopen(fileName);
% --------------------------------------------------------------------
function Main_Callback(hObject, eventdata, handles)
% hObject handle to Main (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function About_Callback(hObject, eventdata, handles)
% hObject handle to About (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Quit_Callback(hObject, eventdata, handles)
% hObject handle to Quit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(handles.figure1);
% --------------------------------------------------------------------
function Save_Callback(hObject, eventdata, handles)
% hObject handle to Save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
f = figure;
copyobj(handles.axes2, f)
copyobj(handles.axes1, f)
saveas(f, 'Plotting Panel.png')
% --------------------------------------------------------------------
function SaveFigs_Callback(hObject, eventdata, handles)
% hObject handle to SaveFigs (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)