function varargout = ejer6c6(varargin) % EJER6C6 M-file for ejer6c6.fig % EJER6C6, by itself, creates a new EJER6C6 or raises the existing % singleton*. % % H = EJER6C6 returns the handle to a new EJER6C6 or the handle to % the existing singleton*. % % EJER6C6('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in EJER6C6.M with the given input arguments. % % EJER6C6('Property','Value',...) creates a new EJER6C6 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before ejer6c6_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to ejer6c6_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help ejer6c6 % Last Modified by GUIDE v2.5 20-Nov-2011 13:50:05 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ejer6c6_OpeningFcn, ... 'gui_OutputFcn', @ejer6c6_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 ejer6c6 is made visible. function ejer6c6_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 ejer6c6 (see VARARGIN) % Choose default command line output for ejer6c6 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes ejer6c6 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = ejer6c6_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; function nft1_Callback(hObject, eventdata, handles) % hObject handle to nft1 (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 nft1 as text % str2double(get(hObject,'String')) returns contents of nft1 as a double % --- Executes during object creation, after setting all properties. function nft1_CreateFcn(hObject, eventdata, handles) % hObject handle to nft1 (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 nft2_Callback(hObject, eventdata, handles) % hObject handle to nft2 (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 nft2 as text % str2double(get(hObject,'String')) returns contents of nft2 as a double % --- Executes during object creation, after setting all properties. function nft2_CreateFcn(hObject, eventdata, handles) % hObject handle to nft2 (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 ftt_Callback(hObject, eventdata, handles) % hObject handle to ftt (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 ftt as text % str2double(get(hObject,'String')) returns contents of ftt as a double % --- Executes during object creation, after setting all properties. function ftt_CreateFcn(hObject, eventdata, handles) % hObject handle to ftt (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 calculoft. function calculoft_Callback(hObject, eventdata, handles) % hObject handle to calculoft (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=str2num(get(handles.nft1, 'String')); %Almacena los coeficientes del los nuemradores b=str2num(get(handles.dft1, 'String')); % y denominadores de las funciones transferencias c=str2num(get(handles.nft2, 'String')); d=str2num(get(handles.dft2, 'String')); ft1=tf(a,b); %Convierte los datos utilizados en variables tf ft2=tf(c,d); ftt=ft1*ft2; %Calculamos la función transferencia total directa [f,g]=tfdata(ftt,'v'); %Obtenemos los coeficientes del num y den. en formato numérico set(handles.nftt,'String',num2str(f)); %Presentamos los datos obtenidos anteriormente set (handles.dfft,'String',num2str(g)); guidata(hObject, handles); %Almacenamos los valores para uso posterior %set(handles.f2,'String',num2str(F2)); function r_Callback(hObject, eventdata, handles) % hObject handle to r (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 r as text % str2double(get(hObject,'String')) returns contents of r as a double % --- Executes during object creation, after setting all properties. function r_CreateFcn(hObject, eventdata, handles) % hObject handle to r (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 calculofte. function calculofte_Callback(hObject, eventdata, handles) % hObject handle to calculofte (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=str2num(get(handles.nft1, 'String')); %Almacena los coeficientes del los nuemradores b=str2num(get(handles.dft1, 'String')); % y denominadores de las funciones transferencias c=str2num(get(handles.nft2, 'String')); d=str2num(get(handles.dft2, 'String')); z=str2num(get(handles.r, 'String')); ft1=tf(a,b); %Convierte los datos utilizados en variables tf ft2=tf(c,d); ftt=ft1*ft2; %Calculamos la función transferencia total directa fte=ftt/(1+ftt*z); [h,i]=tfdata(fte,'v'); %Obtenemos los coeficientes del num y den. en formato numérico set(handles.nfte,'String',num2str(h)); %Presentamos los datos obtenidos anteriormente set(handles.dfte,'String',num2str(i)); guidata(hObject, handles); %Almacenamos los valores para uso posterior function nfte_Callback(hObject, eventdata, handles) % hObject handle to nfte (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 nfte as text % str2double(get(hObject,'String')) returns contents of nfte as a double % --- Executes during object creation, after setting all properties. function nfte_CreateFcn(hObject, eventdata, handles) % hObject handle to nfte (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 trazaresp. function trazaresp_Callback(hObject, eventdata, handles) % hObject handle to trazaresp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) a=str2num(get(handles.nft1, 'String')); %Almacena los coeficientes del los nuemradores b=str2num(get(handles.dft1, 'String')); % y denominadores de las funciones transferencias c=str2num(get(handles.nft2, 'String')); d=str2num(get(handles.dft2, 'String')); z=str2num(get(handles.r, 'String')); ft1=tf(a,b); %Convierte los datos utilizados en variables tf ft2=tf(c,d); ftt=ft1*ft2; %Calculamos la función transferencia total directa fte=ftt/(1+ftt*z); fta=tf(1,[1 0]); %obtenemos la función transferencia "2/s" fteg=fte*fta; axes(handles.axes1); %configura los ejes t=0:0.1:10; j=step(fteg,t); er=2*t'-2*j; plot(t,2*j,'-',t,2*t,'-',t,er,'+'); legend('Respuesta','Señal de entrada','Error','Location','NorthWest'); grid; title('Respuesta a una rampa de pendiente "2"'); xlabel('t (s)'); ylabel ('Amplitud'); function dft1_Callback(hObject, eventdata, handles) % hObject handle to dft1 (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 dft1 as text % str2double(get(hObject,'String')) returns contents of dft1 as a double % --- Executes during object creation, after setting all properties. function dft1_CreateFcn(hObject, eventdata, handles) % hObject handle to dft1 (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 dft2_Callback(hObject, eventdata, handles) % hObject handle to dft2 (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 dft2 as text % str2double(get(hObject,'String')) returns contents of dft2 as a double % --- Executes during object creation, after setting all properties. function dft2_CreateFcn(hObject, eventdata, handles) % hObject handle to dft2 (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 dfft_Callback(hObject, eventdata, handles) % hObject handle to dfft (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 dfft as text % str2double(get(hObject,'String')) returns contents of dfft as a double % --- Executes during object creation, after setting all properties. function dfft_CreateFcn(hObject, eventdata, handles) % hObject handle to dfft (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 nftt_Callback(hObject, eventdata, handles) % hObject handle to nftt (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 nftt as text % str2double(get(hObject,'String')) returns contents of nftt as a double % --- Executes during object creation, after setting all properties. function nftt_CreateFcn(hObject, eventdata, handles) % hObject handle to nftt (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 during object creation, after setting all properties. function calculofte_CreateFcn(hObject, eventdata, handles) % hObject handle to calculofte (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called function dfte_Callback(hObject, eventdata, handles) % hObject handle to dfte (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 dfte as text % str2double(get(hObject,'String')) returns contents of dfte as a double % --- Executes during object creation, after setting all properties. function dfte_CreateFcn(hObject, eventdata, handles) % hObject handle to dfte (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 % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over calculofte. function calculofte_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to calculofte (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)