Adquisición de datos

Enviado por hernando299
    1. Análisis y procedimiento
    2. Programa de adquisición de datos
    3. Interfaz gráfica

ANÁLISIS Y PROCEDIMIENTO

Para la toma de adquisición de datos tomamos una frecuencia de muestreo Fs = 300Hz.

Conectamos la señal de salida del circuito a una DAQ para poder visualizar la señal analógica producida promotor GENERADOR y con ayuda de la implementación de filtros por medio del software poder disminuir el ruido de dicha señal.

Se diseñaron 4 filtros digitales elimina banda (Butterwoth, Cheby I, Cheby II, Eliptico) los cuales tienen como función eliminar la componente de ruido de 60Hz.

Al observar las gráficas obtenidas es muy difícil cual de los 4 filtros cumple su mejor función pero mirando detenidamente para nosotros el mejor es el filtro elíptico.

PROGRAMA DE ADQUISICION DE DATOS

%Se borran todas las variables que existen, se limpia la pantalla, se cierran las ventanas de los graficos%

clear;

clc;

close;

Fs=300;

%Creamos un object device para poder introducir señales analogicas%

SA = analoginput('nidaq',1);

%Se añade un canal a la entrada analogica creada especificando un ID asociado con el hardware del canal empleado%

addchannel(SA,1);

%Asignamos el valor de la tasa de muestreo%

set(SA,'sampleRate',Fs)

%Asignamos el valor de las muestras por disparo%

set(SA,'SamplesPerTrigger',1200)

%Damos inicio a la adquisicion de la entrada analogica, y a los valores de muestras que se determinaron%

start(SA)

%Condicion para que el programa se mantenga activo mientras exista la entrada analogica%

disp('Por favor espere...')

while strcmp(SA.Running,'On')

end

data = getdata(SA);

figure(1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

delete(SA)

clear SA

save datos.mat data Fs -double –tabs

PROGRAMA DE FILTROS DIGITALES

clc

load datos.mat

nmuestras=length(data);

%Coeficientes filtro Butterworth

Den1=[1 -1.227 2.3468 -1.2089 0.97082];

Num1=[0.9853 -1.218 2.347 -1.218 0.9853];

%filtro cheby1

N=4; %orden del filtro

R=1; %decibeles en la banda de paso

Wn=[80/Fs 165/Fs]; %Banda de frecuencias

[Num2,Den2] = cheby1(N,R,Wn,'stop');

%filtro cheby2

N=4; %orden del filtro

R=60; %decibeles en la banda de paso

Wn=[115/Fs 125/Fs]; %Banda de frecuencias

[Num3,Den3] = cheby2(N,R,Wn,'stop');

%filtro ellip

N=4; %orden del filtro

Rp=1; %decibeles en la banda de paso

Rs=80; %decibeles en la banda eliminada

Wn=[115/Fs 125/Fs]; %Banda de frecuencias

[Num4,Den4] = ellip(N,Rp,Rs,Wn,'stop');

data1=filter(Num1,Den1,data);

data2=filter(Num2,Den2,data);

data3=filter(Num3,Den3,data);

data4=filter(Num4,Den4,data);

[h1,f1,s1] = freqz(Num1,Den1,nmuestras,Fs);

[h2,f2,s2] = freqz(Num2,Den2,nmuestras,Fs);

[h3,f3,s3] = freqz(Num3,Den3,nmuestras,Fs);

[h4,f4,s4] = freqz(Num4,Den4,nmuestras,Fs);

figure(1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

figure(2)

subplot(2,1,1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

subplot(2,1,2)

plot(data1)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL FILTRADA (Butter)')

figure(3)

subplot(2,1,1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

subplot(2,1,2)

plot(data2)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL FILTRADA (ChebyI)')

figure(4)

subplot(2,1,1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

subplot(2,1,2)

plot(data3)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL FILTRADA (ChebyII)')

figure(5)

subplot(2,1,1)

plot(data)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL DE ENTRADA')

subplot(2,1,2)

plot(data4)

axis([0 1200 -7 7]);

xlabel('Muestras')

ylabel('Señal en voltios')

title('SEÑAL FILTRADA (Elliptico)')

figure(6),freqzplot(h1,f1,s1),title('Filtro Butterworth')

figure(7),freqzplot(h2,f2,s2),title('Filtro ChebyI')

figure(8),freqzplot(h3,f3,s3),title('Filtro ChebyII')

figure(9),freqzplot(h4,f4,s4),title('Filtro Eliptico')

figure(10)

subplot(4,1,1)

zplane(Num1,Den1)

subplot(4,1,2)

zplane(Num2,Den2)

subplot(4,1,3)

zplane(Num3,Den3)

subplot(4,1,4)

zplane(Num4,Den4)

pause

close all

INTERFAZ GRAFICA

OBJETIVOS

  • Diseñar por medio una herramienta de Matlab una interfaz grafica
  • Realizar un software que me permita facilitar el acceso a la información y adquirir conocimientos acerca de la señal.
  • Por medio de esta herramienta analizar de una forma practica la señal adquirida por el circuito.

PROGRAMAS PARA LA REALIZACION DE LA INTERFAZ GRAFICA

function varargout = cardio(varargin)

% CARDIO Application M-file for cardio.fig

% FIG = CARDIO launch cardio GUI.

% CARDIO('callback_name', ...) invoke the named callback.

% Last Modified by GUIDE v2.0 01-Dec-2003 17:53:59

if nargin == 0 % LAUNCH GUI

fig = openfig(mfilename,'reuse');

% Generate a structure of handles to pass to callbacks, and store it.

handles = guihandles(fig);

guidata(fig, handles);

if nargout > 0

varargout{1} = fig;

end

elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK

try

[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard

catch

disp(lasterr);

end

end

%| ABOUT CALLBACKS:

%| GUIDE automatically appends subfunction prototypes to this file, and

%| sets objects' callback properties to call them through the FEVAL

%| switchyard above. This comment describes that mechanism.

%|

%| Each callback subfunction declaration has the following form:

%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)

%|

%| The subfunction name is composed using the object's Tag and the

%| callback type separated by '_', e.g. 'slider2_Callback',

%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.

%|

%| H is the callback object's handle (obtained using GCBO).

%|

%| EVENTDATA is empty, but reserved for future use.

%|

%| HANDLES is a structure containing handles of components in GUI using

%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This

%| structure is created at GUI startup using GUIHANDLES and stored in

%| the figure's application data using GUIDATA. A copy of the structure

%| is passed to each callback. You can store additional information in

%| this structure at GUI startup, and you can change the structure

%| during callbacks. Call guidata(h, handles) after changing your

%| copy to replace the stored original so that subsequent callbacks see

%| the updates. Type "help guihandles" and "help guidata" for more

%| information.

%|

%| VARARGIN contains any extra arguments you have passed to the

%| callback. Specify the extra arguments by editing the callback

%| property in the inspector. By default, GUIDE sets the property to:

%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))

%| Add any extra arguments after the last argument, before the final

%| closing parenthesis.

% --------------------------------------------------------------------

function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)

clc;

%adq = analoginput('nidaq', 1);

%addchannel(adq,1);

%Fs=eval(get(handles.edit1,'String'));

%tadq=eval(get(handles.edit2,'String'));

%nmuestras=Fs*tadq;

%set(adq,'SampleRate',Fs)

%set(adq,'SamplesPerTrigger',nmuestras)

%start(adq)

%set(handles.status,'String','Adquiriendo');

%while strcmp(adq.Running,'On')

%end

%data = getdata(adq);

load datos2.mat %%%%%%%%%%%%

nmuestras=length(data);

Fs=300;

tadq=nmuestras/Fs; %%%%%%%%%%

tiempo=linspace(0,tadq,nmuestras);

axes(handles.axes1)

plot(tiempo,data),zoom on, grid on

xlabel('Tiempo (sg)')

ylabel('Rango de Voltajes')

save datos.mat data Fs tadq -double -tabs

% --------------------------------------------------------------------

function varargout = slider1_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.slider1.

set(handles.text2,'String',fix(get(gcbo,'Value')))

% --------------------------------------------------------------------

function varargout = slider2_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.slider2.

set(handles.text4,'String',fix(get(gcbo,'Value')))

% --------------------------------------------------------------------

function varargout = pushbutton2_Callback(h, eventdata, handles, varargin)

clc;

load datos

N=4;

Wn=[80 165]/Fs;

[Num,Den] = butter(N,Wn,'stop');

dataf=filter(Num,Den,data);

plot(dataf),zoom on, grid on

% --------------------------------------------------------------------

function varargout = pushbutton3_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton3.

clc;

load datos

N=4;

R=1;

Wn=[80 165]/Fs;

[Num,Den] = cheby1(N,R,Wn,'stop');

dataf=filter(Num,Den,data);

plot(dataf),zoom on, grid on

% --------------------------------------------------------------------

function varargout = pushbutton4_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton4.

clc;

load datos

N=4;

R=60;

Wn=[115 125]/Fs;

[Num,Den] = cheby2(N,R,Wn,'stop');

dataf=filter(Num,Den,data);

plot(dataf),zoom on, grid on

% --------------------------------------------------------------------

function varargout = pushbutton5_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton5.

clc;

load datos

N=4;

Rp=1;

Rs=80;

Wn=[115 125]/Fs;

[Num,Den] = ellip(N,Rp,Rs,Wn,'stop');

dataf=filter(Num,Den,data);

plot(dataf),zoom on, grid on

% --------------------------------------------------------------------

function varargout = pushbutton6_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton6.

close(gcf)

% --------------------------------------------------------------------

function varargout = pushbutton11_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton11.

clc;

load datos

nmuestras=length(data);

N=4;

Wn=[80 165]/Fs;

[Num,Den] = butter(N,Wn,'stop');

[h,f,s] = freqz(Num,Den,nmuestras,Fs);

s.plot='mag';

s.xunits = 'khz';

s.yunits = 'linear';

freqzplot(h,f,s),title('Respuesta del Filtro')

figure(1),set(gcf,'Name','Polos y Ceros','Numbertitle','off')

zplane(Num,Den)

% --------------------------------------------------------------------

function varargout = pushbutton12_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton12.

clc;

load datos

nmuestras=length(data);

N=4;

R=1;

Wn=[75 165]/Fs;

[Num,Den] = cheby1(N,R,Wn,'stop');

[h,f,s] = freqz(Num,Den,nmuestras,Fs);

s.plot='mag';

s.xunits = 'khz';

s.yunits = 'linear';

freqzplot(h,f,s),title('Respuesta del Filtro')

figure(1),set(gcf,'Name','Polos y Ceros','Numbertitle','off')

zplane(Num,Den)

% --------------------------------------------------------------------

function varargout = pushbutton13_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton13.

clc;

load datos

nmuestras=length(data);

N=4;

R=60;

Wn=[115 125]/Fs;

[Num,Den] = cheby2(N,R,Wn,'stop');

[h,f,s] = freqz(Num,Den,nmuestras,Fs);

s.plot='mag';

s.xunits = 'khz';

s.yunits = 'linear';

freqzplot(h,f,s),title('Respuesta del Filtro')

figure(1),set(gcf,'Name','Polos y Ceros','Numbertitle','off')

zplane(Num,Den)

% --------------------------------------------------------------------

function varargout = pushbutton14_Callback(h, eventdata, handles, varargin)

% Stub for Callback of the uicontrol handles.pushbutton14.

clc;

load datos

nmuestras=length(data);

N=4;

Rp=1;

Rs=80;

Wn=[115 125]/Fs;

[Num,Den] = ellip(N,Rp,Rs,Wn,'stop');

[h,f,s] = freqz(Num,Den,nmuestras,Fs);

s.plot='mag';

s.xunits = 'khz';

s.yunits = 'linear';

freqzplot(h,f,s),title('Respuesta del Filtro')

figure(1),set(gcf,'Name','Polos y Ceros','Numbertitle','off')

zplane(Num,Den)

RIGOBERTO HERNANDO OLARTE

hernando299[arroba]hotmail.com

ING Mecatronico. BUCARAMANGA – SANTANDER – COLOMBIA

Comentarios


Trabajos relacionados

Ver mas trabajos de Ingenieria

   

Nota al lector: es posible que esta página no contenga todos los componentes del trabajo original (pies de página, avanzadas formulas matemáticas, esquemas o tablas complejas, etc.). Recuerde que para ver el trabajo en su versión original completa, puede descargarlo desde el menú superior.


Todos los documentos disponibles en este sitio expresan los puntos de vista de sus respectivos autores y no de Monografias.com. El objetivo de Monografias.com es poner el conocimiento a disposición de toda su comunidad. Queda bajo la responsabilidad de cada lector el eventual uso que se le de a esta información. Asimismo, es obligatoria la cita del autor del contenido y de Monografias.com como fuentes de información.