660 likes | 1.03k Views
MATLAB Solution For Data Acquisition and Signal Processing. 鈦思科技 應用工程師 潘俊憲 josh@terasoft.com.tw. Agenda. MATLAB Solution For Test And Measurement Signal Processing Using MATLAB Toolbox MATLAB Graphical User Interface development environment Signal Processing Using SIMULINK.
E N D
MATLAB Solution For Data Acquisition and Signal Processing 鈦思科技 應用工程師 潘俊憲 josh@terasoft.com.tw
Agenda • MATLAB Solution For Test And Measurement • Signal Processing Using MATLAB Toolbox • MATLAB Graphical User Interface development environment • Signal Processing Using SIMULINK
Test and Measurement Toolbox Signal Processing Toolbox Data Analysis, Modeling & Visualization Idea and Results Sharing Algorithm Development & Simulation Application Deployment Mathematical Modeling R&D Workflow Hardware, Files, Database, … Data I/O Ideas Compiler Toolbox
MATLAB Toolbox for data acquisition & analysis • Data Acquisition Toolbox • Instrument Control Toolbox • Image Acquisition Toolbox
MATLAB Test & Measurement Suite • MATLAB • For analysis and visualization • Provides the foundation of the suite • Serial port interface • Data Acquisition Toolbox • For communicating with industry standard data acquisition hardware • Instrument Control Toolbox • For controlling and communicating with GPIB and VXI instruments • Additional application-specific toolboxes • Signal processing, Statistics, Wavelet, Communications, Neural Network, etc. • Sharing test results from MATLAB • Data export, Report Generation
Why Test & Measurement tools for MATLAB? • In the “good old days” • Multiple people • Test Engineers or technicians collecting data • Engineers and scientist working with measured data • Multiple software packages or environments • Static access to data • In today’s world with the T&M tools • One engineer does it all - measurement and analysis • Measurement can be both live and static • One software package for a solution • Don’t need to learn multiple, distinct tools
Test & Measurement Challenges Example BEFORE: Standalone Data Acquisition Software File MATLAB MATLAB T&M SOLUTION: Integrated Test and Analysis MATLAB
Data Acquisition Hardware (A/D, D/A, DIO) DataAcquisition 010101010101011 Physical Quantity System bus Sensor Microphone 0 1 1 0 1 Noise Serial, GPIB, TCP-IP Instrument Control Stand-Alone Instruments Framework of Test & Measurement Analog Digital
MATLAB Toolbox for data acquisition & analysis • Data Acquisition Toolbox • Instrument Control Toolbox • Image Acquisition Toolbox
Data Acquisition Hardware Sensor / Transducer Physical Quantity + - Actuator/Driver Tank Level A Tank Level Control Example
Feature • Get data into and out of MATLAB - Seamless integration with MATLAB and MATLAB Toolboxes • Data logging • Save data to other data type • Use MATLAB function configuration your hardware • Software oscilloscope – softscope • Create Yourself scope – Guide • Interface with industry standard data acquisition devices
DAQ Support Hardware • Advantech • IOTech (Third Party Adaptor) • Keithley Instruments • Measurement Computing • National Instruments • United Electronic Industries (Third Party Adaptor) • VXI Technologies • Microsoft Windows compatible sound cards
Sound Card Demo Softscope
» ai = analoginput(‘winsound’); » addchannel(ai,1); » set(ai, ’SampleRate’, 44100); » start(ai) » data=getdata(ai) data = 0.030 0.014 - 0.010 ... » delete(ai) » clear ai Create Configure Connect Read/Write Disconnect / clean-up Data Acquisition Session
MATLAB Toolbox for data acquisition & analysis • Data Acquisition Toolbox • Instrument Control Toolbox • Image Acquisition Toolbox
Instrument Cable Communication Port Function Generator Digital Multimeter DC Power Supply Oscilloscope Spectrum Analyzer ... Commands / Responses Instrument Control Toolbox
Instrument Control Toolbox Graphical User Interfaces Interfaces make it easy to communicate with instruments Analysis fromacquired data
Instrument Supported Hardware • GPIB boards • Agilent Technologies (formerly HP) • Capital Equipment Corporation (CEC) • ComputerBoards • IOTech • Keithley • National Instruments • VISA Interface • National Instruments and Agilent support • Includes serial port, GPIB, VXI and GPIB-VXI support • Serial port • Extended functionality (GUIs, Hardware Information, etc) in toolbox
Instrument Control Session Data Acquisition Session » ai = analoginput(‘winsound’); » addchannel(ai,1); » set(ai, ’SampleRate’, 44100); » start(ai) » data=getdata(ai) data = 0.030 0.014 - 0.010 ... » delete(ai) » clear ai » g = gpib(’ni’,0,2); » g.Timeout=1; % Second » fopen(g) » fprintf(g, 'Measurement:Meas1:Value?') » fscanf(g) ans = 4.0399999619E0 » query(g, 'Measurement:Meas1:Value?’) ans = 4.0400 » fclose(g) » delete(g) » clear s Create Configure Connect Read/Write Disconnect / clean-up
PC (Matlab) PC (Matlab) Serial port GPIB card VISA card DAQ H/W A/DDI D/ADO Instrument Plant Plant Data Acquisition Toolbox Instrument Control Toolbox
MATLAB Toolbox for data acquisition & analysis • Data Acquisition Toolbox • Instrument Control Toolbox • Image Acquisition Toolbox
1. Enhancing images 2. Extracting information from images What is Image Processing? 1. Intro to Imaging in MATLAB
The MathWorks Solution • MATLAB, Image Processing Toolbox and Image Acquisition Toolbox • Single environment for image analysis, algorithm design, and deployment • Wide range of pre-built image processing functions • Wide range of other toolboxes available in single environment for multi-disciplinary tasks • Easy to verify, customize, and extend algorithms • Multiple, seamless deployment options
Scientific Imaging in MATLAB MATLAB + Image Acquisition Toolbox + Image Processing Toolbox • A complete, integrated environment for the Scientific Imaging community. • Includes built-in acquisition, visualization, and analysis capabilities, as well as an intuitive language for building algorithms and applications. • Reduces development time • Improves productivity • Encourages creativity
IAT Features • Stream images and video directly into MATLAB from hardware • Multi-vendor hardware support • Provides access to configurable device properties • Live video previewing 3. Features and Pricing
Image Acquisition Toolbox BEFORE: OUR SOLUTION: Hardware Hardware MATLAB Software Image Image MATLAB Image Processing Toolbox Image Processing Toolbox
IAT Supported Hardware – Video Devices • Frame Grabbers (analog or digital): • A plug-in circuit board that receives an image from a camera or several cameras for use by the PC. • IAT supports frame grabbers from MATROX and Data Translation, National Instruments is not supported • IAT supports any camera that works with supported framegrabbers, including Cohu and Hamamatsu cameras • Scientific Video Cameras (USB or FireWire) • Higher performance and cost than WebCams, used for industrial and research applications • Plugs directly into computer, doesn’t use Frame Grabber. • Sony and Hamamatsu are popular manufacturers • IAT supports cameras that have WDM or VFW drivers. • WebCam (USB or FireWire) • Low-cost, consumer level video camera • IAT supports WebCams that have WDM or VFW drivers 3. Features and Pricing
IAT Supported Hardware – Video Devices • DV Camcorders • Consumer grade digital video camcorders, typically with FireWire interfaces • Canon, Sony, Panasonic, and JVC are popular manufacturers • IAT supports camcorders that have WDM or VFW drivers. • TV Tuner/Capture Boards • Consumer grade devices that let you view television on your computer or connect to VCRs and DVD players • IAT does not record audio with the video • IAT supports boards with WDM or VFW drivers. 3. Features and Pricing Full list of supported hardware at www.mathworks.com/products
Agenda • MATLAB Solution For Test And Measurement • Signal Processing Using MATLAB Toolbox • MATLAB Graphical User Interface development environment • Signal Processing Using SIMULINK
Add Noise to Source Denoising Signal Source Signal Processing Overview Spectral Analysis Transforms
Key Features • Comprehensive function set of signal processing and filter design methods • Tools for finite impulse response (FIR) and infinite impulse response (IIR) digital filter and analog filter design, analysis • Access to the most widely used transforms, such as fast Fourier and discrete cosine • Tools for spectral analysis and statistical signal processing • Routines for waveform generation, including a Gaussian pulse generator, a periodic sinc generator, and a pulse train generator • Functions for parametric time-series modeling • Graphical user interfaces for designing, analyzing, and visualizing signals, filters, and windows
DEMO : Filter Design • Infinite impulse response (IIR) Could be unstable • Finite impulse response (FIR) a=1 Always Stable • Using the command line or the GUI FDATool
Filter Specification • Wp, Ws, Rp, Rs Passband Ripple Stopband Attenuation Fs/2 Passband Transition Band Stopband Passband Transition Band
Filter Design GUI • >>FDATool Analysis methods Type & method to use Mode Selector Filter specifications
Agenda • MATLAB Solution For Test And Measurement • Signal Processing Using MATLAB Toolbox • MATLAB Graphical User Interface development environment • Signal Processing Using SIMULINK
What Is GUIDE? • provides a set of tools for creating graphical user interfaces (GUIs). • These tools greatly simplify the process of designing and building GUIs. • You can use the GUIDE tools to : - Lay out the GUI - Program the GUI
DEMO : • Create an easy GUI :
ActiveX Control Property Inspector Create Guide --> ActiveX
Example >> GUI_activeX
DEMO : • Integrate With Data Acquisition In GUI
Deployment Standalone • Stand-alone applications can run even if MATLAB is not installed on the end-user's system. • C and C++ shared libraries (dynamically linked libraries, or DLLs, on Microsoft Windows). • These can be used without MATLAB on the end-user's system. • You can recompile any of your existing M-files that are compatible with MATLAB Release 14 products.
Agenda • MATLAB Solution For Test And Measurement • Signal Processing Using MATLAB Toolbox • MATLAB Graphical User Interface development environment • Signal Processing Using SIMULINK
Signal Processing Using SIMULINK • Signal Processing Blockset • Video and Image Processing Blockset
Signal Processing Blockset 6.0.1 • Transforms: Fast Fourier transform, discrete cosine transform, real and complex cepstrum. • Filtering: Digital filter design and implementation, adaptive, • Quantizer: A quantizer and uniform encoder and decoder. • Operations: Convolution, down sample, integer delay, unwrap, zero pad, and window function. • Statistics: Correlation, maximum, mean, RMS. • Signal Source and Sink.
Application : AM modulation • y=Km(1+a*cos (2*pi(1000)t))*cos (2*pi(10000)t)