Skip to content

Commit 8fbc0ef

Browse files
authored
Update Nyquist and Step Function Response GUI
1 parent 096f7b4 commit 8fbc0ef

File tree

1 file changed

+323
-0
lines changed

1 file changed

+323
-0
lines changed

Nyquist and Step Function Response GUI

+323
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,326 @@ close
131131

132132

133133
%% NYQUIST
134+
function varargout = nyquist_function(varargin)
135+
% NYQUIST_FUNCTION MATLAB code for nyquist_function.fig
136+
% NYQUIST_FUNCTION, by itself, creates a new NYQUIST_FUNCTION or raises the existing
137+
% singleton*.
138+
%
139+
% H = NYQUIST_FUNCTION returns the handle to a new NYQUIST_FUNCTION or the handle to
140+
% the existing singleton*.
141+
%
142+
% NYQUIST_FUNCTION('CALLBACK',hObject,eventData,handles,...) calls the local
143+
% function named CALLBACK in NYQUIST_FUNCTION.M with the given input arguments.
144+
%
145+
% NYQUIST_FUNCTION('Property','Value',...) creates a new NYQUIST_FUNCTION or raises the
146+
% existing singleton*. Starting from the left, property value pairs are
147+
% applied to the GUI before nyquist_function_OpeningFcn gets called. An
148+
% unrecognized property name or invalid value makes property application
149+
% stop. All inputs are passed to nyquist_function_OpeningFcn via varargin.
150+
%
151+
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
152+
% instance to run (singleton)".
153+
%
154+
% See also: GUIDE, GUIDATA, GUIHANDLES
155+
156+
% Edit the above text to modify the response to help nyquist_function
157+
158+
% Last Modified by GUIDE v2.5 04-Dec-2023 21:05:35
159+
160+
% Begin initialization code - DO NOT EDIT
161+
gui_Singleton = 1;
162+
gui_State = struct('gui_Name', mfilename, ...
163+
'gui_Singleton', gui_Singleton, ...
164+
'gui_OpeningFcn', @nyquist_function_OpeningFcn, ...
165+
'gui_OutputFcn', @nyquist_function_OutputFcn, ...
166+
'gui_LayoutFcn', [] , ...
167+
'gui_Callback', []);
168+
if nargin && ischar(varargin{1})
169+
gui_State.gui_Callback = str2func(varargin{1});
170+
end
171+
172+
if nargout
173+
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
174+
else
175+
gui_mainfcn(gui_State, varargin{:});
176+
end
177+
% End initialization code - DO NOT EDIT
178+
179+
180+
% --- Executes just before nyquist_function is made visible.
181+
function nyquist_function_OpeningFcn(hObject, eventdata, handles, varargin)
182+
% This function has no output args, see OutputFcn.
183+
% hObject handle to figure
184+
% eventdata reserved - to be defined in a future version of MATLAB
185+
% handles structure with handles and user data (see GUIDATA)
186+
% varargin command line arguments to nyquist_function (see VARARGIN)
187+
188+
% Choose default command line output for nyquist_function
189+
handles.output = hObject;
190+
191+
% Update handles structure
192+
guidata(hObject, handles);
193+
194+
function varargout = nyquist_function_OutputFcn(hObject, eventdata, handles)
195+
196+
varargout{1} = handles.output;
197+
198+
199+
200+
function edit1_Callback(hObject, eventdata, handles)
201+
202+
function edit1_CreateFcn(hObject, eventdata, handles)
203+
204+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
205+
set(hObject,'BackgroundColor','white');
206+
end
207+
208+
209+
210+
function edit2_Callback(hObject, eventdata, handles)
211+
212+
function edit2_CreateFcn(hObject, eventdata, handles)
213+
214+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
215+
set(hObject,'BackgroundColor','white');
216+
end
217+
218+
219+
220+
function edit3_Callback(hObject, eventdata, handles)
221+
222+
function edit3_CreateFcn(hObject, eventdata, handles)
223+
ave a white background on Windows.
224+
% See ISPC and COMPUTER.
225+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
226+
set(hObject,'BackgroundColor','white');
227+
end
228+
229+
230+
% --- Executes on button press in pushbutton1.
231+
function pushbutton1_Callback(hObject, eventdata, handles)
232+
233+
global x f
234+
235+
num=str2sym(get(handles.edit1,'String'));
236+
denum=str2sym(get(handles.edit2,'String'));
237+
238+
c=str2double(split(get(handles.edit3,'String')));
239+
240+
num1=sym2poly(num);
241+
denum1=sym2poly(denum);
242+
243+
f=tf(num1,denum1);
244+
x=logspace(c(1),c(2));
245+
246+
247+
% eventdata reserved - to be defined in a future version of MATLAB
248+
% handles structure with handles and user data (see GUIDATA)
249+
250+
251+
%% STEP RESPONSE
252+
function varargout = stepresponse_func(varargin)
253+
% STEPRESPONSE_FUNC MATLAB code for stepresponse_func.fig
254+
% STEPRESPONSE_FUNC, by itself, creates a new STEPRESPONSE_FUNC or raises the existing
255+
% singleton*.
256+
%
257+
% H = STEPRESPONSE_FUNC returns the handle to a new STEPRESPONSE_FUNC or the handle to
258+
% the existing singleton*.
259+
%
260+
% STEPRESPONSE_FUNC('CALLBACK',hObject,eventData,handles,...) calls the local
261+
% function named CALLBACK in STEPRESPONSE_FUNC.M with the given input arguments.
262+
%
263+
% STEPRESPONSE_FUNC('Property','Value',...) creates a new STEPRESPONSE_FUNC or raises the
264+
% existing singleton*. Starting from the left, property value pairs are
265+
% applied to the GUI before stepresponse_func_OpeningFcn gets called. An
266+
% unrecognized property name or invalid value makes property application
267+
% stop. All inputs are passed to stepresponse_func_OpeningFcn via varargin.
268+
%
269+
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
270+
% instance to run (singleton)".
271+
%
272+
% See also: GUIDE, GUIDATA, GUIHANDLES
273+
274+
% Edit the above text to modify the response to help stepresponse_func
275+
276+
% Last Modified by GUIDE v2.5 04-Dec-2023 21:38:28
277+
278+
% Begin initialization code - DO NOT EDIT
279+
gui_Singleton = 1;
280+
gui_State = struct('gui_Name', mfilename, ...
281+
'gui_Singleton', gui_Singleton, ...
282+
'gui_OpeningFcn', @stepresponse_func_OpeningFcn, ...
283+
'gui_OutputFcn', @stepresponse_func_OutputFcn, ...
284+
'gui_LayoutFcn', [] , ...
285+
'gui_Callback', []);
286+
if nargin && ischar(varargin{1})
287+
gui_State.gui_Callback = str2func(varargin{1});
288+
end
289+
290+
if nargout
291+
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
292+
else
293+
gui_mainfcn(gui_State, varargin{:});
294+
end
295+
% End initialization code - DO NOT EDIT
296+
297+
298+
% --- Executes just before stepresponse_func is made visible.
299+
function stepresponse_func_OpeningFcn(hObject, eventdata, handles, varargin)
300+
% This function has no output args, see OutputFcn.
301+
% hObject handle to figure
302+
% eventdata reserved - to be defined in a future version of MATLAB
303+
% handles structure with handles and user data (see GUIDATA)
304+
% varargin command line arguments to stepresponse_func (see VARARGIN)
305+
306+
% Choose default command line output for stepresponse_func
307+
handles.output = hObject;
308+
309+
% Update handles structure
310+
guidata(hObject, handles);
311+
312+
% UIWAIT makes stepresponse_func wait for user response (see UIRESUME)
313+
% uiwait(handles.figure1);
314+
315+
316+
% --- Outputs from this function are returned to the command line.
317+
function varargout = stepresponse_func_OutputFcn(hObject, eventdata, handles)
318+
% varargout cell array for returning output args (see VARARGOUT);
319+
% hObject handle to figure
320+
% eventdata reserved - to be defined in a future version of MATLAB
321+
% handles structure with handles and user data (see GUIDATA)
322+
323+
% Get default command line output from handles structure
324+
varargout{1} = handles.output;
325+
326+
327+
328+
function edit5_Callback(hObject, eventdata, handles)
329+
% hObject handle to edit5 (see GCBO)
330+
% eventdata reserved - to be defined in a future version of MATLAB
331+
% handles structure with handles and user data (see GUIDATA)
332+
333+
% Hints: get(hObject,'String') returns contents of edit5 as text
334+
% str2double(get(hObject,'String')) returns contents of edit5 as a double
335+
336+
337+
% --- Executes during object creation, after setting all properties.
338+
function edit5_CreateFcn(hObject, eventdata, handles)
339+
% hObject handle to edit5 (see GCBO)
340+
% eventdata reserved - to be defined in a future version of MATLAB
341+
% handles empty - handles not created until after all CreateFcns called
342+
343+
% Hint: edit controls usually have a white background on Windows.
344+
% See ISPC and COMPUTER.
345+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
346+
set(hObject,'BackgroundColor','white');
347+
end
348+
349+
350+
351+
function edit12_Callback(hObject, eventdata, handles)
352+
% hObject handle to edit12 (see GCBO)
353+
% eventdata reserved - to be defined in a future version of MATLAB
354+
% handles structure with handles and user data (see GUIDATA)
355+
356+
% Hints: get(hObject,'String') returns contents of edit12 as text
357+
% str2double(get(hObject,'String')) returns contents of edit12 as a double
358+
359+
360+
% --- Executes during object creation, after setting all properties.
361+
function edit12_CreateFcn(hObject, eventdata, handles)
362+
% hObject handle to edit12 (see GCBO)
363+
% eventdata reserved - to be defined in a future version of MATLAB
364+
% handles empty - handles not created until after all CreateFcns called
365+
366+
% Hint: edit controls usually have a white background on Windows.
367+
% See ISPC and COMPUTER.
368+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
369+
set(hObject,'BackgroundColor','white');
370+
end
371+
372+
373+
374+
function edit13_Callback(hObject, eventdata, handles)
375+
% hObject handle to edit13 (see GCBO)
376+
% eventdata reserved - to be defined in a future version of MATLAB
377+
% handles structure with handles and user data (see GUIDATA)
378+
379+
% Hints: get(hObject,'String') returns contents of edit13 as text
380+
% str2double(get(hObject,'String')) returns contents of edit13 as a double
381+
382+
383+
% --- Executes during object creation, after setting all properties.
384+
function edit13_CreateFcn(hObject, eventdata, handles)
385+
% hObject handle to edit13 (see GCBO)
386+
% eventdata reserved - to be defined in a future version of MATLAB
387+
% handles empty - handles not created until after all CreateFcns called
388+
389+
% Hint: edit controls usually have a white background on Windows.
390+
% See ISPC and COMPUTER.
391+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
392+
set(hObject,'BackgroundColor','white');
393+
end
394+
395+
396+
397+
function edit14_Callback(hObject, eventdata, handles)
398+
% hObject handle to edit14 (see GCBO)
399+
% eventdata reserved - to be defined in a future version of MATLAB
400+
% handles structure with handles and user data (see GUIDATA)
401+
402+
% Hints: get(hObject,'String') returns contents of edit14 as text
403+
% str2double(get(hObject,'String')) returns contents of edit14 as a double
404+
405+
406+
% --- Executes during object creation, after setting all properties.
407+
function edit14_CreateFcn(hObject, eventdata, handles)
408+
% hObject handle to edit14 (see GCBO)
409+
% eventdata reserved - to be defined in a future version of MATLAB
410+
% handles empty - handles not created until after all CreateFcns called
411+
412+
% Hint: edit controls usually have a white background on Windows.
413+
% See ISPC and COMPUTER.
414+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
415+
set(hObject,'BackgroundColor','white');
416+
end
417+
418+
419+
function pushbutton1_Callback(hObject, eventdata, handles)
420+
421+
global x f
422+
423+
num=str2sym(get(handles.edit15,'String'));
424+
denum=str2sym(get(handles.edit13, 'String'));
425+
426+
a=str2double(split(get(handles.edit14,'String'),':'));
427+
428+
num1=sym2poly(num);
429+
denum1=sym2poly(denum);
430+
431+
f=tf(num1,denum1);
432+
x=linspace(a(1),a(2));
433+
434+
435+
436+
437+
function edit15_Callback(hObject, eventdata, handles)
438+
% hObject handle to edit15 (see GCBO)
439+
% eventdata reserved - to be defined in a future version of MATLAB
440+
% handles structure with handles and user data (see GUIDATA)
441+
442+
% Hints: get(hObject,'String') returns contents of edit15 as text
443+
% str2double(get(hObject,'String')) returns contents of edit15 as a double
444+
445+
446+
% --- Executes during object creation, after setting all properties.
447+
function edit15_CreateFcn(hObject, eventdata, handles)
448+
% hObject handle to edit15 (see GCBO)
449+
% eventdata reserved - to be defined in a future version of MATLAB
450+
% handles empty - handles not created until after all CreateFcns called
451+
452+
% Hint: edit controls usually have a white background on Windows.
453+
% See ISPC and COMPUTER.
454+
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
455+
set(hObject,'BackgroundColor','white');
456+
end

0 commit comments

Comments
 (0)