Skip to content
MathWorks - Mobile View
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
MathWorks
  • Productos
  • Soluciones
  • Educación
  • Soporte
  • Comunidad
  • Eventos
  • Obtenga MATLAB
  • Inicie sesión cuenta de MathWorksInicie sesión cuenta de MathWorks
  • Access your MathWorks Account
    • Mi Cuenta
    • Mi perfil de la comunidad
    • Asociar Licencia
    • Cerrar sesión

Vídeos y webinars

  • MathWorks
  • Vídeos
  • Vídeos-Inicio
  • Buscar
  • Vídeos-Inicio
  • Buscar
  • Comuníquese con ventas
  • Software de prueba
5:14 Video length is 5:14.
  • Description
  • Full Transcript
  • Related Resources

Data Acquisition in MATLAB Without Writing Code

Common data acquisition tasks can be performed in MATLAB® without writing code. The Analog Input Recorder app allows you to acquire analog voltage, current, or audio data from supported devices. The Signal Analyzer app provides visualization and signal analysis capabilities. And you can output analog data using the Analog Output Generator app.

Each of these apps allows you to perform a task and then automatically generate the equivalent MATLAB code for that task so you can easily configure your environment and perform the same analysis again in the future. 
In this video, these steps are demonstrated using audio data as an example. Audio is recorded into MATLAB from a microphone, a low-pass filter is applied, and the resulting signal is generated on a speaker. The automatically generated MATLAB code is then assembled in a single MATLAB script that can run the whole workflow.

The Analog Input Recorder and Analog Output Generator apps are included with Data Acquisition Toolbox™. The Signal Analyzer app is included with Signal Processing Toolbox™.

In this video, I’ll show how you can acquire, analyze, and generate analog signals in MATLAB without writing code. To do this, you can use interactive apps in MATLAB.

To acquire data, you can use the Analog Input Recorder from Data Acquisition Toolbox. This app allows you to acquire analog voltage signals from supported DAQ devices and audio signals from audio devices. I’ll acquire audio data from my headset microphone. Let’s record five seconds’ worth of data while I whistle.

As you can see, this is recorded to the MATLAB workspace. Here it is in a timetable, which is nice because this single variable contains the timing information and the data. I can select the data and plot it in MATLAB. And if I zoom in, I can see that this audio data has a sinusoidal behavior.

Now if I want to perform this same acquisition configured the same way in the future, I can generate a script. This script provides me with the equivalent MATLAB code to perform these same steps in the future. Let’s save the script.

Now that I’ve acquired some data, what if I want to analyze it? I can use the Signal Analyzer app from Signal Processing Toolbox. This app offers me a number of things I can do with the data stored in this DAQ_1 timetable. I can visualize it in the time domain, but I can also look at it in the frequency domain or in a time-frequency plot. If I zoom into this region where I have the strongest frequencies, I can clearly see in the time-frequency plot those notes that I whistled.

In addition to visualizing data, I can also perform analysis like a low-pass filter. Let’s say I want to remove some of these higher frequencies. I can set a passband frequency of 1 kHz and bump up the steepness. As you can see, some of these higher frequencies are cut out and some of those higher notes that I whistled are no longer visible here.

From this app, I can export this new data into MATLAB, and I can also generate a function. You can see here that this function gives me the MATLAB code for creating that same low-pass filter with 1000 Hz passband frequency and a steepness of 0.9999. Let’s save this function.

I’ve acquired data. I’ve done some analysis. I can also output data. We can use the Analog Output Generator app from Data Acquisition Toolbox. I’ll output audio data to my computer’s soundbar. For comparison, I’ll first output the data that we originally recorded in the DAQ_1 variable. Now let’s listen to the data that we analyzed with that low-pass filter in DAQ_1_ch1.

As before, I can generate a script to perform these steps in the future. This again provides me with a MATLAB code version to perform the same configuration and signal generation.

Now I’ve generated the equivalent MATLAB code for each of these three steps. How do I tie them all together in a single workflow? Well, I’ve created this script template here, and I can take that automatically generated code and add it in. The code for AcquireAudio, GenerateAudio, and for the preprocessing step, we have a function with this signature. But instead of preprocessing x and tx, we preprocess the data that we acquired in this acquire audio step: data and timesteps. And this function gives us a variable y. So when we generate audio, instead of generating DAQ_1_ch1.ch1, we’ll generate the data in y. So let’s run this all together.

That’s how you can acquire, analyze, and generate analog data in MATLAB without writing code. Thank you.

Related Products

  • Data Acquisition Toolbox
  • Signal Processing Toolbox

3 Ways to Speed Up Model Predictive Controllers

Read white paper

A Practical Guide to Deep Learning: From Data to Deployment

Read ebook

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Deep Learning and Traditional Machine Learning: Choosing the Right Approach

Read ebook

Hardware-in-the-Loop Testing for Power Electronics Control Design

Read white paper

Predictive Maintenance with MATLAB

Read ebook

Electric Vehicle Modeling and Simulation - Architecture to Deployment : Webinar Series

Register for Free

How much do you know about power conversion control?

Start quiz

Feedback

Featured Product

Data Acquisition Toolbox

  • Request Trial
  • Get Pricing

Up Next:

3:49
Connecting to DAQ Devices Without Writing Code

Related Videos:

53:22
Acquiring Data from Standalone Instruments and Data...
2:58
Data Acquisition in MATLAB
7:04
Overview - Data Acquisition Toolbox
55:21
Acquiring Data from Sensors and Instruments Using MATLAB

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Comuníquese con ventas
  • Software de prueba

MathWorks

Accelerating the pace of engineering and science

MathWorks es el líder en el desarrollo de software de cálculo matemático para ingenieros

Descubra…

Explorar productos

  • MATLAB
  • Simulink
  • Software para estudiantes
  • Soporte para hardware
  • File Exchange

Probar o comprar

  • Descargas
  • Software de prueba
  • Comuníquese con ventas
  • Precios y licencias
  • Cómo comprar

Aprender a utilizar

  • Documentación
  • Tutoriales
  • Ejemplos
  • Vídeos y webinars
  • Formación

Obtener soporte

  • Ayuda para la instalación
  • MATLAB Answers
  • Consultoría
  • Centro de licencias
  • Comuníquese con soporte

Acerca de MathWorks

  • Ofertas de empleo
  • Sala de prensa
  • Misión social
  • Casos prácticos
  • Acerca de MathWorks
  • Select a Web Site United States
  • Centro de confianza
  • Marcas comerciales
  • Política de privacidad
  • Antipiratería
  • Estado de las aplicaciones

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Únase a la conversación