You are on page 1of 8

function varargout = proyect3(varargin) % PROYECT3 M-file for proyect3.

fig % PROYECT3, by itself, creates a new PROYECT3 or raises the existing % singleton*. % % H = PROYECT3 returns the handle to a new PROYECT3 or the handle to % the existing singleton*. % % PROYECT3('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in PROYECT3.M with the given input arguments. % % PROYECT3('Property','Value',...) creates a new PROYECT3 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before proyect3_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to proyect3_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 proyect3 % Last Modified by GUIDE v2.5 07-Jan-2013 20:51:33 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @proyect3_OpeningFcn, ... 'gui_OutputFcn', @proyect3_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 proyect3 is made visible. function proyect3_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

return end f=1.Outputs from this function are returned to the command line.figure1). title('Serial continua x_{a}(t)').output. % --. % UIWAIT makes proyect3 wait for user response (see UIRESUME) % uiwait(handles. if P<0 || isnan(P) || P>12 errordlg('Escoja un valor entre 1 y 12 para el periodo'. xa = sin(2*pi*f*t).'ERROR'). ins').'String')). % Update handles structure guidata(hObject.'Enable'.grid xlabel('Tiempo.edit1. ylabel('Amplitud'). set(handles. handles).edit2. axes(handles.axes4) grid % --.Executes on button press in pushbutton1. axes(handles.axes2).axes1) grid axes(handles. . eventdata. % hObject handle to figure % eventdata reserved . L=length(t).to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %SEÑAL SENO P=str2double(get(handles.output = hObject.% handles % varargin structure with handles and user data (see GUIDATA) command line arguments to proyect3 (see VARARGIN) % Choose default command line output for proyect3 handles.'off') axes(handles. function pushbutton1_Callback(hObject.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. handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved . eventdata. handles) % varargout cell array for returning output args (see VARARGOUT). function varargout = proyect3_OutputFcn(hObject.axes2) grid axes(handles.axes1) plot(t. t = 0:0.xa).01: P.axes3) grid axes(handles.

ya. stem(k.0 title('Señal discreta x[n]'). ya=sinc((1/T)*t(:.P/0. handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved .edit2. axes(handles.0001:P. axes(handles.'m'.'or'. ret.nn.'Reconstruida'. xc=sin(2*pi*f*nn). function pushbutton2_Callback(hObject.'Original'). . grid on %RECONSTRUCCION FILTRO PASABAJO %Como tenemos la señal muestreada tenemos que reconstruirla por tanto usamos la funcion sinc(x) %que es la funcion seno(x) dividida en x. xa = cos(2*pi*f*t). %RETENCION DE LA SEÑAL MUESTREADA ret=timeseries(xs. ylabel('Amplitud').grid.timeinfo.'String')). plot(ret1).name=' Retencion'.xs. %genera un filtro pasa-bajo ideal. n2=(0:T:P)'. L=length(t). k = 0:length(n)-1.k). ret.t. de longitud infinita. title('Comparacion de las señales') xlabel('Time') ylabel('Amplitude') axis([0 P -1 1]).1. if P<0 || isnan(P) || P>12 errordlg('Escoja un valor entre 1 y 12 para el periodo'.T = 0.axes1) plot(t. legend('Muestras'.'--b').xa).grid xlabel('Tiempo. ret1=ret. ins'). t = 0:0. t=linspace(0.ones(size(n2)))-(1/T)*n2(:.to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %SEÑAL COSENO P=str2double(get(handles.Executes on button press in pushbutton2. xs = sin(2*pi*f*n).axes4) plot(n2.ones(size(t)))')*xs. xlabel('Indice de muestreo').'ERROR'). xs=sin(2*pi*f*n2).0001)'.xc. nn=0:0.01: P.axes3). % --.setinterpmethod('Zoh'). axes(handles. eventdata. return end f=1. pero como no podemos generarla al infinito la generaremos de forma %truncada o con limite.xs). La funcion sinc(x).units='h'.P. n = 0:T: P.grid.

edit2. eventdata.t. nn=0:0. ya=sinc((1/T)*t(:. de longitud infinita. title('Serial continua x_{a}(t)').0 title('Señal discreta x[n]'). % --.nn.0001)'. axes(handles. xlabel('Indice de muestreo').k).ones(size(n2)))-(1/T)*n2(:.P.xs. plot(ret1). grid on %RECONSTRUCCION FILTRO PASABAJO %Como tenemos la señal muestreada tenemos que reconstruirla por tanto usamos la funcion sinc(x) %que es la funcion seno(x) dividida en x. La funcion sinc(x).'ERROR').ones(size(t)))')*xs. ret1=ret. .ya. ret.'or'.1. T = 0.axes2). %genera un filtro pasa-bajo ideal. handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved . t=linspace(0.'Original'). n2=(0:T:P)'. axes(handles. xs=cos(2*pi*f*n2).to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % CUADRATICA P=str2double(get(handles.name=' Retencion'. pero como no podemos generarla al infinito la generaremos de forma %truncada o con limite.timeinfo. axes(handles. %RETENCION DE LA SEÑAL MUESTREADA ret=timeseries(xs. title('Comparacion de las señales') xlabel('Time') ylabel('Amplitude') axis([0 P -1 1]).'String')).xs).xc. xs = cos(2*pi*f*n).P/0.axes3).0001:P.ylabel('Amplitud').grid. ylabel('Amplitud'). stem(k. legend('Muestras'. if P<0 || isnan(P) || P>12 errordlg('Escoja un valor entre 1 y 12 para el periodo'. return end f=1.setinterpmethod('Zoh').grid.'Reconstruida'. n = 0:T: P.units='h'. k = 0:length(n)-1. ret. function pushbutton3_Callback(hObject.'--b'). xc=cos(2*pi*f*nn).axes4) plot(n2.'m'.Executes on button press in pushbutton3.

de longitud infinita. axes(handles. ret1=ret.P. axes(handles. %RETENCION DE LA SEÑAL MUESTREADA ret=timeseries(xs. if P<0 || isnan(P) || P>12 . legend('Muestras'. n2=(0:T:P)'. title('Serial continua x_{a}(t)').k).xa. ret.axes2) T = 0.01: P.50).ones(size(t)))')*xs.ones(size(n2)))-(1/T)*n2(:.edit2.units='h'.50). title('Comparacion de las señales') xlabel('Time') ylabel('Amplitude') % --.50).'Reconstruida'.'r').ya. L=length(t). stem(k. function pushbutton4_Callback(hObject.axes3) plot(ret1.0001)'.axes1) plot(t.axes4) plot(n2.xs). axes(handles. xs = square(2*pi*f*n.'m'.'Original'). ylabel('Amplitud').setinterpmethod('Zoh').xs. ya=sinc((1/T)*t(:. xa = square(2*pi*f*t.t = 0:0. %genera un filtro pasa-bajo ideal. xs=square(2*pi*f*n2. k = 0:length(n)-1.timeinfo.name=' Retencion'. n = 0:T: P.t.50). ret.Executes on button press in pushbutton4.'--b'). t=linspace(0.'r'). handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved . pero como no podemos generarla al infinito la generaremos de forma %truncada o con limite. ylabel('Amplitud'). axes(handles.'String')).xc. xlabel('Indice de muestreo').grid. La funcion sinc(x). ins').1.'or'. grid on %RECONSTRUCCION FILTRO PASABAJO %Como tenemos la señal muestreada tenemos que reconstruirla por tanto usamos la funcion sinc(x) %que es la funcion seno(x) dividida en x.0001:P.0 title('Señal discreta x[n]').P/0.. nn=0:0.nn.grid.to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %DIENTE DE SIERRA P=str2double(get(handles. xc=square(2*pi*f*nn. eventdata.grid xlabel('Tiempo.

'Original').. ins'). function pushbutton5_Callback(hObject. t = 0:0.'m'. %RETENCION DE LA SEÑAL MUESTREADA ret=timeseries(xs.setinterpmethod('Zoh').timeinfo. axes(handles. axes(handles.0001:P.axes1) plot(t.'ERROR'). n2=(0:T:P)'.'or'. xs=sawtooth(2*pi*f*n2). nn=0:0. La funcion sinc(x).axes4) plot(n2.k). %genera un filtro pasa-bajo ideal.grid xlabel('Tiempo. legend('Muestras'. ret.axes3) plot(ret1).0 title('Señal discreta x[n]').. ya=sinc((1/T)*t(:. grid on %RECONSTRUCCION FILTRO PASABAJO %Como tenemos la señal muestreada tenemos que reconstruirla por tanto usamos la funcion sinc(x) %que es la funcion seno(x) dividida en x. eventdata.P.axes2) T = 0. pero como no podemos generarla al infinito la generaremos de forma %truncada o con limite. t=linspace(0. ret.P/0. xa = sawtooth(2*pi*f*t). ret1=ret. axes(handles. stem(k.ones(size(n2)))-(1/T)*n2(:.ones(size(t)))')*xs.grid. de longitud infinita.'Reconstruida'.xs). title('Serial continua x_{a}(t)').name=' Retencion'.xa).Executes on button press in pushbutton5.t. L=length(t). xc=sawtooth(2*pi*f*nn). k = 0:length(n)-1. title('Comparacion de las señales') xlabel('Time') ylabel('Amplitude') % --.'--b').0001)'.nn. ylabel('Amplitud').1.xc. ylabel('Amplitud').xs.units='h'.grid. n = 0:T: P.. xlabel('Indice de muestreo').to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close .ya. return end f=1.errordlg('Escoja un valor entre 1 y 12 para el periodo'.01: P. xs = sawtooth(2*pi*f*n). axes(handles. handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved .

handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. if ispc && isequal(get(hObject.'BackgroundColor'. if ispc && isequal(get(hObject. end .'String') returns contents of edit1 as text % str2double(get(hObject.'String')) returns contents of edit1 as a double % --.Executes during object creation. eventdata. get(0. handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved . % See ISPC and COMPUTER. handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved . eventdata.Executes on selection change in popupmenu1.to be defined in a future version of MATLAB % handles empty . handles) % hObject handle to edit1 (see GCBO) % eventdata reserved .Executes during object creation. % See ISPC and COMPUTER.'defaultUicontrolBackgroundColor')) set(hObject.'Value')} returns selected item from popupmenu1 % --. end function edit1_Callback(hObject.% --. function popupmenu1_Callback(hObject. eventdata.to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject.'white').'white'). get(0.handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.'BackgroundColor').'BackgroundColor'.'String')) returns popupmenu1 contents as cell array % contents{get(hObject. function edit1_CreateFcn(hObject. handles) % hObject handle to edit1 (see GCBO) % eventdata reserved .to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject.to be defined in a future version of MATLAB % handles empty . eventdata.'BackgroundColor').'defaultUicontrolBackgroundColor')) set(hObject. function popupmenu1_CreateFcn(hObject. after setting all properties. after setting all properties.

'BackgroundColor'.to be defined in a future version of MATLAB % handles empty . handles) % hObject handle to edit2 (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.handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.Executes during object creation.'String')) returns contents of edit2 as a double % --. % See ISPC and COMPUTER.'white').'String') returns contents of edit2 as text % str2double(get(hObject. after setting all properties.'defaultUicontrolBackgroundColor')) set(hObject. if ispc && isequal(get(hObject. eventdata. end . handles) % hObject handle to edit2 (see GCBO) % eventdata reserved . function edit2_CreateFcn(hObject.'BackgroundColor').function edit2_Callback(hObject. get(0. eventdata.