Presentation is loading. Please wait.

Presentation is loading. Please wait.

About MATLAB® Chapter 1 Welcome to Chapter 1 of MATLAB for Engineers. In this chapter we’ll introduce you to the MATLAB computer software program.

Similar presentations


Presentation on theme: "About MATLAB® Chapter 1 Welcome to Chapter 1 of MATLAB for Engineers. In this chapter we’ll introduce you to the MATLAB computer software program."— Presentation transcript:

1 About MATLAB® Chapter 1 Welcome to Chapter 1 of MATLAB for Engineers. In this chapter we’ll introduce you to the MATLAB computer software program

2 Objectives After studying this chapter you should be able to:
Understand what MATLAB is and why it is widely used in engineering and science Understand the advantages and limitations of the student edition of MATLAB Formulate problems by using a structured problem-solving approach

3 What’s in this Chapter? What is MATLAB? Student Edition of MATLAB
How is MATLAB used in industry? Problem Solving in Engineering and Science We’ll take a look at what the software can do, introduce the student edition of MATLAB, and we’ll look at some examples of how MATLAB is used in industry. Finally, we’ll introduce a problem solving strategy that is commonly used in science and engineering.

4 Section What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools Others include Maple Mathematica MathCad 1. So what is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computational tools. There are other similar programs, including Maple, Mathematica and MathCad. Each of these programs has its own strengths. For example Maple is particularly good at symbolic manipulation, and is often the program of choice in Math classes. At one time Maple was used as the engine for MATLAB’s symbolic algebra capability.

5 MATLAB excels at: Numerical calculations Graphics
Especially involving matrices Graphics MATLAB stands for Matrix Laboratory MATLAB is particularly good at numerical calculations, especially if a problem can be posed using matrix mathematics. It also has outstanding graphics capabilities. The name of the program, MATLAB, is short for Matrix Laboratory, and reflects the fact that MATLAB views all calculations as the manipulation of matrices. The matrix is the basic data type for all MATLAB information

6 Why MATLAB Easy to use Versatile Built in programming language
Not a general purpose language like C++ or Java 1. So why use MATLAB. MATLAB is the most common choice of a mathematical computation tool for scientists and engineers, because it is easy to use – yet is extremely versatile. You can use it like a calculator, or you can take advantage of its built in programming language to solve complicated problems. 2. It isn’t a general purpose programming language like C++ or Java – its been optimized to solve numerical problems. If you wanted to create an application program like a word processor, you wouldn’t choose MATLAB.

7 MATLAB was originally written in Fortran, then later rewritten in C
As a matter of fact, MATLAB is a large application program, and was originally written in Fortran…. then later rewritten in C.

8 MATLAB 8 MATLAB is updated regularly
Versions that predate MATLAB 5.5 are substantially different MATLAB 8 was introduced in late 2012, and features a new interface Like most large application programs, MATLAB is constantly updated and improved. This text refers to MATLAB 8, which was introduced in Earlier versions of the software are very similar, however versions that predate MATLAB 5.5 use a command line structure instead of the graphical user interface introduced in MATLAB 7. MATLAB 8 was introduced in late 2012 and features a new interface… however the structure of the program is virtually unchanged.

9 Release Numbers The Mathworks packages their software in groups, called releases Release 2013a includes MATLAB 8.1 Simulink A number of specialized “toolboxes” 1. MATLAB is published by a company call the Mathworks. Their software is usually packaged in groups, called releases. 2. This text refers to release 2013a, which includes MATLAB 8.1, Simulink – which is a companion program used to model dynamic systems - and a number of specialized toolboxes. Toolboxes are groups of functions unique to certain industries or tasks. For example there is a data analysis toolbox with expanded capability past what ships with a standard MATLAB installation. These toolboxes are sold separately. This book is based on Release 2013a

10 Releases New releases are issued twice a year in the spring and in the fall

11 Section 1.2 Student Edition of MATLAB
MATLAB comes in both a student and professional edition Student editions are available for Windows Operating Systems Mac OS Linux The student edition typically lags the professional edition by one release The Mathworks provides a student edition of MATLAB, which is available both online and in college bookstores. 2. The student edition is available for Windows operating systems, MacOs and Linux.

12 The student edition of release 2013a includes
Full featured MATLAB 8.1 Simulink Symbolic toolbox based on MuPad Limited number of other commonly used toolboxes The student edition of release 2013a includes the full featured MATLAB 8 program, Simulink and major portions of the symbolic toolbox. Simulink is limited to 1000 blocks, where the professional version is limited only by your computer resources. Other toolboxes can be purchased separately for use with the student edition. Remember – the software is continually updated, and the release you purchase may include later versions of the software titles.

13 The command prompt is the biggest difference you’ll notice
>> is the command prompt for the professional version EDU>> is the command prompt for the student version You should see very little difference between a professional version of MATLAB and the student version. The only obvious difference is the command prompt – which is where you enter data into the program. It’s a double pointed bracket in the professional version, and is the abbreviation EDU followed by the double pointed bracket in the student edition.

14 Section 1.3 How is MATLAB used in Industry?
Widespread, especially in the signal processing field Tool of choice in Academia for most engineering fields Some examples…. MATLAB is widely used both in industry and in academia. It has found particularly wide acceptance in the signal processing field, and so is very common in Electrical Engineering departments in colleges and universities. However, in the last several years it has been steadily replacing general purpose programming languages in all the engineering disciplines.

15 Electrical Engineering
These images were created to help visualize the arrangements of electromagnetic fields in space and time. Images created by Dr. James Nagel at the University of Utah For example, electrical engineers often use images created in MATLAB to visualize electromagnetic fields. The first image represents a surface plasmon polariton. It’s A peculiar phenomenon that occurs at the boundary between a conductive metal (like copper or aluminum) and a dielectric (like air or glass). When excited properly, electrical charges along the surface of the metal can propagate energy in the form of waves bounded to the metal/dielectric interface. This is the basis for a field of study known as plasmonics, and is still leading to new discoveries and new electronic devices to this day. This image was created using MATLAB’s graphics capabilities. Similarly the second image represents light scattering by a circular metal cylinder. In particular its the cross-section of an electromagnetic plane wave as it strikes a metal cylinder. Notice how some of the wave energy appears to "bend" around the edges. This phenomenon is known as diffraction, and is a common feature to all waves. Even though there is a distinct shadow region behind the cylinder, it is never quite in perfect darkness. The final image represents beam forming by a six-element dipole array. When multiple antennas are placed in proximity to one another, their radiated energy tends to overlap, or interfere. In some directions, this overlap adds to the intensity of the final wave, while in others it can cancel out entirely. When designed properly, the radiation of energy can even be steered into specific directions with very high precision. This is extremely useful for such applications as wireless communication over long distances, aircraft tracking radar, and radio astronomy. Here, we are looking down onto the electrical field radiated by six Hertzian dipoles. Notice how there appears to be a main beam that is skewed at an angle into space.

16 Biomedical Engineering
MATLAB is also being used in the medical field. These images were created from MRI data, using MATLAB. The actual data set is included with the standard MATLAB installation, allowing you experiment with manipulating the data yourself. These images were created from MRI scan data using MATLAB. The actual data set is included with the standard MATLAB installation, allowing you experiment with manipulating the data yourself.

17 Fluid Dynamics Computational fluid dynamics is an area that is especially well suited to formulating problems as matrices. This particular image is the result of a finite element analysis. A gas generator, in the lower left corner of the model creates high temperature and pressure gas, which travels thru a curved pipe shown near the center of the model, and into a “plenum” – which is just a fancy word for a gas holding tank. The arrows represent both the direction in which the gas is traveling, and the velocity of the gas. This is actually a three dimensional image, which could be rotated in MATLAB and viewed from any angle. Results from a finite element analysis code were post processed using MATLAB to create this image.

18 Section 1.4 Problem Solving in Engineering and Science
State the Problem Describe the input and output Develop an algorithm Solve the problem Test the solution Before we actually learn how to solve problems in MATLAB, we need to go over a standardized approach to problem solving commonly found in all science and engineering disciplines. In this 5 step process, 1.first you state the problem, 2.then describe the input and output. 3. Next you develop a plan for solving the problem, called an algorthim. 4.Then you actually solve the problem, in our case using MATLAB, and 5. finally you test your solution for reasonableness. Let’s go thru that process one step at a time

19 State the Problem If you don’t have a clear understanding of the problem, it’s unlikely that you’ll be able to solve it Drawing a picture often helps you understand the system better Stating the problem may seem like a waste of time, but if you don’t have a clear understanding of a problem its unlikely that you’ll be able to solve it. Drawing a picture is often a great way to describe a problem.

20 Describe the Input and Output
Be careful to include units Identify constants Label your sketch Group information into tables Once you know what the problem is, then we need to carefully identify what we know, and what we want to find out. In this step its important to identify units and to identify any constants you may need. Its useful to add this information to your sketch, or to group the information into tables.

21 Develop an Algorithm Identify any equations relating the knowns and unknowns Work through a simplified version of the problem by hand or with a calculator Developing a flow chart is often useful for complicated problems The next step is to identify any equations relating the knowns and unknowns, and then to work thru a simplified version of the problem. You could do this by hand or with a calculator. If the problem is complicated, it’s useful to develop a flow chart that organizes the steps you’ll take to solve the problem.

22 Solve the problem Create a MATLAB solution
Be generous with comments, so that others can follow your work Now its time to convert your algorithm into a MATLAB solution. As you create a MATLAB program you should include comments, so that others can follow your work, or so that you can remember why you took a given approach.

23 Test the Solution Compare to the hand solution
Do your answers make sense physically? Is your answer really what was asked for? Graphs are often useful ways to check your calculations for reasonableness Once you’ve solved the problem with MATLAB, you still aren’t done. Its important to compare your solution to a hand solution and to check to see if your answers make physical sense. At this point you should also revisit the problem statement – did you really solve for the requested output? One effective way to evaluate your results is to create a graph. Once you are convinced that your solution works, you can use your MATLAB program to solve similar problems with different inputs.

24 If you use a consistent problem solving strategy you increase the chance that your result is correct
Here’s an example…. Remember, if you use a consistent problem solving strategy, you increase the chance that your result is correct. Lets solve a problem now using MATLAB, and our problem solving approach

25 Example 1.1 Albert Einstein E=mc2
The sun is fueled by the conversion of matter to energy How much matter does the sun consume every day? This is example 1.1 in the textbook. 1.Albert Einstein is arguably the most famous scientist of the twentieth century. 2.His simple equation relating energy and matter revolutionized physics. The conversion of matter to energy is what fuels the stars We can use this equation, E=mc2 to find out how much matter is converted to energy in the sun everyday.

26 State the Problem Find the amount of matter necessary to produce the amount of energy radiated by the sun everyday First state the problem Find the amount of matter necessary to produce the amount of energy radiated by the sun everyday

27 Describe the Input and Output
Rate of energy radiation E = 385*1024 Joules/second Speed of light c = 3.0*108 meters/second Output Mass in kilograms As input, we know that the rate of energy radiation is 385 times 10 to the 24th Joules per second. We also know the speed of light, 3 times 10 to the 8th meters/second. Our output will be the mass converted to energy in kilograms.

28 Develop an Algorithm – Hand Example
The energy radiated in one day is: Rearrange E=mc2 and solve for m m=E/c2 This is an easy problem to solve by hand. The hard part is the units conversions. ……… Take the energy radiation rate and multiply by the conversion factor for hours to seconds and the conversion factor from days to hours and finally multiply by one day – the amount of time in our analysis. We can see that the units cancel out leaving us with Joules. Then rearrange E equals m c squared to solve for m and substitute in the value for energy and the speed of light.

29 But the units are wrong!! 1 J = 1 kg m2/sec2
If we are careful with our units, we see that the answer comes out in J/m2/sec2 – not kg!! 2. We need one more conversion factor. 3. Substituting in we see that the result is in kg, as expected

30 Develop a MATLAB Solution to Solve the Problem
We’ll start learning the details of how to use MATLAB in the next chapter. However, you can see from the following demonstration just how easy it is to use the command window Of course, at this point we haven’t learned how to use MATLAB, however you can see from the following demonstration just how easy it is to use the command window.

31 Once again, the result is repeated back to you in the command window
Now enter the equation to calculate the mass Enter the value for c, the speed of light Notice that the value of E is updated based on your calculation Once you hit the enter key, the program repeats your input. Notice the use of scientific notation in the result Now enter the equation to change the energy rate from kJ/day to kJ/s. Enter the value for E at the command prompt

32 Test your Solution Matches the hand solution Is it reasonable?
Consider… Mass of the sun = 2*1020 kg How long would it take to consume all that mass? The MATLAB solution matches the hand solution – but is it reasonable? It’s a really big number – could it possibly be right? Consider that the sun masses 2 times 10 to the 20th kg. How long would it take to consume the sun if it continues to burn matter at the rate we’ve calculated?

33 time = (mass of the sun)/(rate of consumption)
That’s 15 trillion years!! Yes – this is a reasonable result Time is going to equal the mass of the sun, divided by the rate of consumption. That gives us 15 trillion years, so yes – that is a reasonable result. We don’t need to worry about the sun being consumed any time soon.

34 Summary MATLAB is widely used MATLAB is easy to use
A systematic problem solving strategy makes it more likely you’ve found the right answer In this chapter we introduced you to MATLAB, which is a widely used mathematical computation program. We also demonstrated how easy it is to use. Finally we introduced a systematic problem solving strategy that we will use thru out the text. This systematic approach makes it much more likely that you will find the correct answer when you solve with problems with MATLAB.


Download ppt "About MATLAB® Chapter 1 Welcome to Chapter 1 of MATLAB for Engineers. In this chapter we’ll introduce you to the MATLAB computer software program."

Similar presentations


Ads by Google