﻿ The Top Ten Uses of MATLAB - MATLAB For Dummies, 2nd Edition

Part 6

# The Part of Tens

IN THIS PART …

Performing analysis and conducting research

Delving into audio and graphic analysis

Working with sensors and machines

Finding your next occupation

Chapter 21

# The Top Ten Uses of MATLAB

IN THIS CHAPTER

Performing analysis and solving problems

Conducting research

Working with audio and graphics

Interacting with sensors and machines

MATLAB is used in a lot of different ways by lots of people in occupations you might not necessarily think about when it comes to a math product. In fact, math is used in ways that many people don’t consider. For example, video games simply wouldn’t exist without a lot of relatively complex math. However, even the chair you’re sitting in required some use of math to ensure that it would perform as expected. A mission to Mars or to the bottom of the ocean would be impossible without all sorts of different math applications. Even the mixtures of food we eat require an explanation based on math principles. In short, you might be surprised at just how many different ways MATLAB is being used, and this chapter tells you only about ten of the most popular uses. Explaining every potential MATLAB use would likely require an entire book.

Working with Linear Algebra

It may be hard to believe, but linear algebra really is part of the workplace (and not just for sending someone to the moon). For example, to calculate Return on Investment (ROI), you must know algebra. The same holds true for the following:

· Predicting the amount of turnover a company will have

· Determining how many items to keep in inventory

· Making life and business decisions, such as whether it’s cheaper to rent a car or to buy one outright

· Creating a financial plan, such as determining whether it makes more sense to pay down a credit card or build up savings

No one would obtain MATLAB to perform these tasks just one time. However, if your job is helping people perform these sorts of tasks, you really do need something like MATLAB so that you can get the answers you need fast.

Uses for linear algebra often appear in places that you might never consider. For example, if you’re a restaurant owner, you might use linear algebra on a regular basis to make your business more efficient. Check out the article at https://smallbusiness.chron.com/restaurants-use-linear-programming-menu-planning-37132.html for details. Imagine how surprised you might be if you walked into the back room of a restaurant sometime to find the manager poking away at a keyboard with a copy of MATLAB running!

Performing Numerical Analysis

Numerical analysis (see https://www.scienceabc.com/eyeopeners/why-do-we-need-numerical-analysis-in-everyday-life.html for a history and overview) relies on approximation rather than the precision you see in symbolic math. It seems that the world is filled with approximations, and so is the galaxy. Performing certain building construction tasks is impossible without applying numerical analysis, and astronomy seems to require heavy use of it as well. You probably won’t see a carpenter applying numerical analysis on the job site with MATLAB, but you will see architects who might need to do so.

Numerical analysis truly does apply to the natural world. For example, much of modern biology and medicine rest on principles described using numerical analysis. Your family physician probably doesn’t require a copy of MATLAB, but the researcher who provides your physician with the information needed to diagnose any problems with your health does. When it comes to numerical analysis, you’re better off thinking about the creative end of things rather than the application. The person inventing a new procedure needs MATLAB, but the person applying it on the job site doesn’t.

Designing a Neural Network Simulation

A neural network makes it possible to simulate the functionality of the human mind and apply it to solving certain classes of problems. You often see neural networks used for sales forecasting, customer research, data validation, and risk management. Delving into the intricacies of neural networks is outside the scope of this book, but you can learn more about them in Deep Learning For Dummies, by John Paul Mueller and Luca Massaron. You can also read a short overview of the topic at https://www.mathworks.com/discovery/neural-network.html.

The MATLAB Deep Learning Toolbox (https://www.mathworks.com/products/deep-learning.html) helps you perform a wide variety of tasks with neural networks. Adding the Parallel Computing Toolbox (https://www.mathworks.com/products/parallel-computing.html) increases processing speed so that you can obtain the answers you need quickly. In fact, getting a timely response is a critical part of designing a neural network.

Trying to picture how a neural network does its work can be quite difficult because the concepts are abstract. One way to overcome this problem is to use MATLAB to create a neural network simulation. The article at https://www.electronicsforu.com/electronics-projects/software-projects-ideas/artificial-neural-network-simulation-labview-matlab provides one approach to creating such a simulation.

Getting Involved in Science

Science is a pretty broad term, but it does have specific applications. MATLAB is likely to be used to explore new theories. It’s important to differentiate between science and engineering in this case. Engineering is the application of known principles and theories to a problem in a predictable and usually standardized manner. Science, on the other hand, is the act of creating, testing, and proving principles and theories to eventually use for solving problems. In other words, when applied to science, MATLAB helps you perform “what if” analysis that helps you confirm (or deny) the viability of a theory (see https://docs.genesys.com/Documentation/DEC/9.0.0/UsrHlp/WhatIf for examples of how what if analysis is used in specific tasks).

Of course, science is used in many different ways. For example, you might be involved in the health industry and use science to find a cure for cancer or a deadly virus. A computer scientist might look for a new way to use computer technology to aid those with accessibility needs. In fact, there are all sorts of ways in which MATLAB could figure into helping someone do something special for humanity.

Logging Sensor Data

Sensors provide the means to monitor events and data of all sorts at a level that no human can match. For example, cameras diligently record activities around a business for security reasons at a remarkable level of reliability. Industrial cameras can record emissions that humans can’t even see. Other sensors record temperature, vibration, sound, and other forms of input that might be impossible to document otherwise.

Unfortunately, the best a sensor can do is to provide input. To use the data, a human or application must receive the input and interpret it, which is where the concept of logging comes into play. Sometimes the data

· Isn’t needed in real time

· Requires preservation as a legal or other requirement

· Appears as raw data that requires analysis

You can see an example of how to log and interpret raw sensor data using a combination of MATLAB and Excel at https://www.electronicsforu.com/electronics-projects/software-projects-ideas/logging-sensor-data-ms-excel-matlab-gui.

Exploring Research

Researchers have the world’s best job in many respects. As a researcher, you get to ask a question, no matter how absurd, and determine whether the question is both answerable and relevant. After the question is answered, a researcher needs to determine whether the answer is both useful and reliable. In short, some view research as a kind of play (and they are correct — it really is play for the creative and intelligent mind).

Of course, research isn’t just fun and games. If it were, people would have flocked to research as they do to video games now. After a question is asked and an answer is given, the researcher must convince colleagues that the answer is correct and then viable to put into practice. MATLAB lets you check the answer and verify that it does, in fact, work as the researcher suggests. After an answer is proven, the researcher can use MATLAB further to define precisely how the answer is used.

Although many of MATLAB’s tasks require light use of graphics, research has a significant need for graphics because the researcher must often explain answers to people who don’t have the researcher’s skills. In most cases, the explanation will never work with a text-only presentation; the researcher must also include plenty of graphics that start with abstract concepts, and then turn them into concrete ideas that the audience can understand.

Creating Light Animations Using Arduino

Light animations are often used for advertising and presentation purposes. There is strong evidence showing that the use of light influences both decision making and perception (see https://www.researchgate.net/publication/330258298_Ambient_Lights_Influence_Perception_and_Decision-Making as an example). The YouTube video at https://www.youtube.com/watch?v=QvrtneelQ8A demonstrates a software-based animation — the animations you create using hardware are far more dramatic.

You can use MATLAB to design various patterns and control the output using Live Script (see Chapter 11). The benefit of using Live Script for this purpose is that you can create a GUI so that the presenter can perform other tasks on the PC while the audience views the various light patterns. You can see an example of this sort of MATLAB use at https://www.electronicsforu.com/electronics-projects/hardware-diy/light-animations-arduino-matlab.

Employing Image Processing

Images are made up of pixels. Each pixel defines a particular color in a specific location in the image. In short, a pixel is a dot of just one color. The color is actually a numeric value that defines how much red, blue, and green to use in order to create the pixel color. Because the pixel is represented as a number, you can use various math techniques to manage the pixel. In fact, images (see the “Working with Images” section of Chapter 16) as well as plots (see Chapters 6 and 7) are often managed as matrices. A matrix is simply a structure consisting of numeric information.

Image processing is the act of managing the pixels in an image using math techniques to modify the matrix values. Techniques such as adding two matrices together are common when performing image processing. In fact, probably any technique you can think of that applies to matrices is also employed in image processing in some way.

The one thing you should know by this point in the book is that MATLAB excels at matrix manipulation. Anyone involved in image processing needs the sort of help that MATLAB provides to create and test new image-processing techniques. The point is that you can test the math and then see the result right onscreen without changing applications. You can use MATLAB to both create the required math and then test it (at least in a simulated environment).

Controlling Industrial Equipment

The ability of MATLAB to use Live Scripts and Live Functions (see Chapters 11 and 12) to graphically model scenarios enables you to use it to create apps (see Chapter 14) that less skilled individuals can use to control equipment from a remote location, such as a control booth. By placing the individual in a control booth, it’s easier to provide a full view of the equipment in a safe environment so that the individual can react when something unexpected happens. The article at https://www.electronicsforu.com/electronics-projects/equipment-controller-using-matlab-based-gui provides an overview of how this process might work with four devices.

Depending on the industry and the level of machine control required, many industrial situations see use of machine learning applications to perform essential machine control (you can download an e-book describing how machine learning works in MATLAB from https://www.mathworks.com/campaigns/offers/mastering-machine-learning-with-matlab.html). However, the idea that a combination of machine learning and advanced control hardware can do the entire job is ill founded. Unexpected situations still require human intervention because machine learning can’t deal with the unexpected (see https://www.lanner-america.com/blog/5-industries-artificial-intelligence-machine-learning-transforming/ and https://usmsystems.com/machine-learning-in-manufacturing/ for an overview of the state of the art in five industries). In fact, machine learning is unlikely to ever be able to take over completely. However, the need for human interaction doesn’t make today’s robots any less interesting to learn about (see the article at https://www.educba.com/what-is-robotics/ for an overview).

The Internet of Things (IoT) presents another industrial-type application with consumer applications. For example, it doesn’t matter to a MATLAB app–controlled device whether it configures lighting in a factory setting or in a home. To the app, it’s just lights (or a thermostat or other device). You can read more about IoT and MATLAB at https://www.educba.com/iot-applications/. The MathWorks page at https://www.mathworks.com/solutions/internet-of-things.html provides additional implementation details.

Performing Audio Compression Using Wavelets

Working with sound can be difficult because not everyone hears sound in the same way. That’s why it’s important to have some means of measuring and defining sound in a specific manner. Fortunately, the MATLAB Signal Processing Toolbox (https://www.mathworks.com/products/signal.html) makes it easy to create Live Script apps that fully analyze sound in the manner you require. The overview at https://www.mathworks.com/help/signal/getting-started-with-signal-processing-toolbox.html provides you with an impressive list of ways to interact with signals of all sorts.

Part of the problem in working with sound, especially on the Internet, is that high-quality sound can consume a great deal of memory, so streaming it becomes nearly impossible. A way around this problem is to compress the sound wave at the source and then decompress the sound wave at the destination. MATLAB can help in this regard as well. You can see an example of this approach at https://www.electronicsforu.com/electronics-projects/audio-compression-haar-wavelet-matlab.

If you find an error or have any questions, please email us at admin@erenow.net. Thank you!