You are on page 1of 16

Using the MATLAB Data Acquisition

Toolbox

By
Mohd Zaki Nuawi
Intro

The software in the toolbox allows MATLAB to


acquire
 data from sensors and to send out electrical
signals that can be used to control or
 drive external devices.
Some definitions and concepts
 Analog to Digital conversion : Most
measurement sensors are analog, that is they provide a
continuous electrical signal. Your computer is digital, it can only
store discrete numbers.
 Sample rate : The number of times the A/D hardware
takes a discrete measurement each second is called the
sample rate. You ought to sample your data much faster than
the quantity you are measuring is changing.
 Triggering : is when you tell the data acquisition hardware
to begin taking data.
Concept of DAQ
Daq Process

So summing up, Data Acquisition is the


process of:
 Acquiring signals from real-world
phenomena
 Digitizing the signals
 Analyzing, presenting and saving the data
Pc-based DAQ
Elements of DAQ

 The parts are:


  Physical input/output signals
  DAQ device/hardware
  Driver software
  Your software application (Application
software)
Simple DAQ Application

A Simple DAQ application should follow these


steps:
 1. Initialization
 2. Read/Write
 3. Analysis
Step 1: Initialization

Initialize your hardware device and the


channels you would like to sample. The first
thing you need to do is create an analog
input device object and open up channels for
data input.
Example

recObj = audiorecorder(16000,16,1);
Step 2: Read/Write

 Set which channel to acquire the signals


 Sampling rate of the signals

recObj = audiorecorder(16000,16,1);
example

 % Record your voice for 2 seconds.


 recObj = audiorecorder(16000,16,1);
 disp('Start speaking.')
 recordblocking(recObj,2); % 2 is equal to 2 sec
recording
 disp('End of Recording.’);
 % Store data in double-precision array.
 myRecording = getaudiodata(recObj);
Step 3: analysis

 filter, and preprocess your data.


 Perform exploratory data analysis to uncover trends, test
assumptions, and build descriptive models.
 MATLAB provides functions for filtering and smoothing,
interpolation, convolution, and fast Fourier transforms
(FFTs).
 Add-on products provide capabilities for 
curve and surface fitting, multivariate statistics, spectral
analysis, image analysis, system identification,
 Other analysis tasks such as I-kazTM and MZN
Example

 PLOT TIME DOMAIN %PLOT FREQUENCY DOMAIN


 % Plot the waveform. a = fft(myRecording);
 plot(myRecording); b = length(a)/2;
power = abs(a(1:b));
 title('TIME DOMAIN')
Fs=16000;
 xlabel('Samples/time') nyq = 1/2;
 ylabel('Signal (Volts)') freq = Fs*(1:b)/b*nyq;
figure
plot(freq,power);
title('FREQUENCY DOMAIN')
xlabel('Frequency (Hz)');
ylabel('Signal (Volts)');
Others analysis
 %SIGNAL PROCESSING :I-KAZ
 L=0.5*Fs;
 fclow = 0.25*L;
 fchigh = 0.5*L;
 [BbL,AaL] = butter(4,fclow/L,'low');
 data_L=filter(BbL,AaL,data);
 [BbH,AaH] = butter(4,[(fclow/L),(fchigh/L)],'bandpass');
 data_H=filter(BbH,AaH,data);
 [BbV,AaV] = butter(4,fchigh/L,'high');
 data_V=filter(BbV,AaV,data);
 N=length(data);
 sL=std(data_L)^4;
 sH=std(data_H)^4;
 sV=std(data_V)^4;
Continue…
 Ikazcoefficient=real(sqrt(sL*KURTOSIS(data_L)+sH*KURTOSIS(data_H)+sV*KURTOSIS(data_V))/N)
 figure
 scatter3(data_L,data_H,data_V);
 title('I-kaz Display');
 xlabel('L');
 ylabel('H');
 zlabel('V');

---------------------------------------------------------------------------------------------------------------------------------------------
--
 %SIGNAL ANALYSIS :M-Z-N
 seg=5
 for h=1:seg
 p=h;
 [KIRAx(p),Zrmssegx,seldat]=calcZrmsSegmentDataX(p,data);
 Zrmsx(h,1:h)=Zrmssegx;
 end

You might also like