The document is a chapter from a textbook on using Matlab for engineering. It discusses how to define and manipulate matrices in Matlab, including scalars, vectors, 2D matrices, indexing, extracting portions of matrices, and problems involving two variables. The chapter will cover defining matrices using lists or multiple lines, basic operations like changing values and adding elements, using colons to generate ranges or extract portions, and indexing matrices in both row/column and single index formats.
Learning matlab in the inverted classroom Robert Talbert
A look at a use of the inverted classroom model to teach introductory scientific programming to freshmen using MATLAB. (Talk delivered to the Computers in Education Division, American Society for Engineering Education conference, 13 June 2012, San Antonio, TX USA.)
Learning matlab in the inverted classroom Robert Talbert
A look at a use of the inverted classroom model to teach introductory scientific programming to freshmen using MATLAB. (Talk delivered to the Computers in Education Division, American Society for Engineering Education conference, 13 June 2012, San Antonio, TX USA.)
Graphical approach representing a group of spot welding parameters setting that falls under body manufacturing requirements. Used to optimize parameters setting to reduce input energy & increase productivity ( increase consumables life span)
This paper presents a new simulator used to distribute and execute real-time simulations: the RT-LAB, developed by opal-RT technologies (Montreal, Canada). One of its essential characteristics is the perfect integration with MATLAB/Simulink. The RT-LAB allows the conversion of Simulink models in real time via real-time workshop (RTW) and their execution on one or more processors. In this context, the paper focuses on the RT-LAB real-time simulation as a complement to the MATLAB/Simulink environment, which has been used to perform the simulation of the Flywheel energy storage system (FESS -variable speed wind generation (VSWG) assembly. The purpose of employing a fairly new real-time platform (RT-LAB OP -5600) is to reduce the test and prototype time. This application will be executed on each element of our model that was previously developed under MATLAB/Simulink. The real-time simulation results are observed in the workstation.
The increase in design sizes and the complexity of timing checks at 40nm technology nodes
and below is responsible for longer run times, high memory requirements, and the need for a
growing set of gate-level simulation (GLS) applications including design for test (DFT) and lowpower considerations. As a result, in order to complete the verification requirements on time,
it becomes extremely important for GLS to be started as early in the design cycle as possible,
and for the simulator to be run in high-performance mode. This application note describes
new methodologies and simulator use models that increase GLS productivity, focusing on two
techniques for GLS to make the verification process more effective
The Rank Positional Weight Method can be used to develop and balance an assembly line. In this method, work elements are divided among workstations depending on the duration of work elements and their precedence position. Copy the link given below and paste it in new browser window to get more information on Ranked Positional Weight Method:-
http://www.transtutors.com/homework-help/industrial-management/line-balancing/ranked-positional-weight-method.aspx
Comparison of Modulation Techniques for Matrix ConverterAsoka Technologies
Matrix Converters can directly convert an ac power supply of fixed voltage into an ac voltage of variable amplitude and frequency. Matrix Converter is a single stage converter. The matrix converters can contribute to the realization of low volume, sinusoidal input current, bidirectional power flow and lack of bulky reactive elements. All the reasons lead to the development of matrix converter. Based on the control techniques used in the matrix converter, the performance varies. So this paper analyses the performance of matrix converter with three different modulation techniques such as PWM, SVPWM and SVM. The basic principle and switching sequence of these modulation techniques are presented in this paper. The output voltage, output current waveforms, voltage transfer ratio and THD spectrum of switching waveforms connected to RL load are analyzed by using Matlab/Simulink software. The simulated results are analyzed and show that the THD is better for SVM technique.
Marios Michailidis & Mathias Muller, H2O.ai - Time Series with H2O Driverless...Sri Ambati
This session was recorded in San Francisco on February 5th, 2019 and can be viewed here: https://youtu.be/0pvvDHfxdZ8
Driverless AI is H2O.ai's latest flagship product for automatic machine learning. It fully automates some of the most challenging and productive tasks in applied data science such as feature engineering, model tuning, model ensembling and model deployment. Driverless AI turns Kaggle-winning grandmaster recipes into production-ready code, and is specifically designed to avoid common mistakes such as under- or overfitting, data leakage or improper model validation, some of the hardest challenges in data science. Avoiding these pitfalls alone can save weeks or more for each model, and is necessary to achieve high modeling accuracy.
Driverless AI is now equipped with time-series functionality. Time series helps forecast sales, predict industrial machine failure and more. With the time series capability in Driverless AI, H2O.ai directly addresses some of the most pressing concerns of organizations across industries for use cases such as transactional data in capital markets, in retail to track in-store and online sales, and in manufacturing with sensor data to improve supply chain or predictive maintenance.
Bio: Marios Michailidis is a Competitive Data Scientist at H2O.ai. He holds a Bsc in accounting Finance from the University of Macedonia in Greece, an Msc in Risk Management from the University of Southampton and a PhD in machine learning at from UCL . He has worked in both marketing and credit sectors in the UK Market and has led many analytics’ projects with various themes including: acquisition, retention, recommenders, fraud detection, portfolio optimization and more. He is the creator of KazAnova, a freeware GUI for credit scoring and data mining 100% made in Java as well as is the creator of StackNet Meta-Modelling Framework. In his spare time he loves competing on data science challenges and was ranked 1st out of 500,000 members in the popular Kaggle.com data competition platform. He currently ranks 3rd.
Bio: A Kaggle Grandmaster and a Data Scientist at H2O.ai, Mathias Müller holds an AI and ML focused diploma (eq. M.Sc.) in computer science from Humboldt University in Berlin. During his studies, he keenly worked on computer vision in the context of bio-inspired visual navigation of autonomous flying quadrocopters. Prior to H2O.ai, he as a machine learning engineer for FSD Fahrzeugsystemdaten GmbH in the automotive sector. His stint with Kaggle was a chance encounter as he stumbled upon the data competition platform while looking for a more ML-focused platform as compared to TopCoder. This is where he entered his first predictive modeling competition and climbed up the ladder to be a Grandmaster. He is an active contributor to XGBoost and is working on Driverless AI with H2O.ai.
Graphical approach representing a group of spot welding parameters setting that falls under body manufacturing requirements. Used to optimize parameters setting to reduce input energy & increase productivity ( increase consumables life span)
This paper presents a new simulator used to distribute and execute real-time simulations: the RT-LAB, developed by opal-RT technologies (Montreal, Canada). One of its essential characteristics is the perfect integration with MATLAB/Simulink. The RT-LAB allows the conversion of Simulink models in real time via real-time workshop (RTW) and their execution on one or more processors. In this context, the paper focuses on the RT-LAB real-time simulation as a complement to the MATLAB/Simulink environment, which has been used to perform the simulation of the Flywheel energy storage system (FESS -variable speed wind generation (VSWG) assembly. The purpose of employing a fairly new real-time platform (RT-LAB OP -5600) is to reduce the test and prototype time. This application will be executed on each element of our model that was previously developed under MATLAB/Simulink. The real-time simulation results are observed in the workstation.
The increase in design sizes and the complexity of timing checks at 40nm technology nodes
and below is responsible for longer run times, high memory requirements, and the need for a
growing set of gate-level simulation (GLS) applications including design for test (DFT) and lowpower considerations. As a result, in order to complete the verification requirements on time,
it becomes extremely important for GLS to be started as early in the design cycle as possible,
and for the simulator to be run in high-performance mode. This application note describes
new methodologies and simulator use models that increase GLS productivity, focusing on two
techniques for GLS to make the verification process more effective
The Rank Positional Weight Method can be used to develop and balance an assembly line. In this method, work elements are divided among workstations depending on the duration of work elements and their precedence position. Copy the link given below and paste it in new browser window to get more information on Ranked Positional Weight Method:-
http://www.transtutors.com/homework-help/industrial-management/line-balancing/ranked-positional-weight-method.aspx
Comparison of Modulation Techniques for Matrix ConverterAsoka Technologies
Matrix Converters can directly convert an ac power supply of fixed voltage into an ac voltage of variable amplitude and frequency. Matrix Converter is a single stage converter. The matrix converters can contribute to the realization of low volume, sinusoidal input current, bidirectional power flow and lack of bulky reactive elements. All the reasons lead to the development of matrix converter. Based on the control techniques used in the matrix converter, the performance varies. So this paper analyses the performance of matrix converter with three different modulation techniques such as PWM, SVPWM and SVM. The basic principle and switching sequence of these modulation techniques are presented in this paper. The output voltage, output current waveforms, voltage transfer ratio and THD spectrum of switching waveforms connected to RL load are analyzed by using Matlab/Simulink software. The simulated results are analyzed and show that the THD is better for SVM technique.
Marios Michailidis & Mathias Muller, H2O.ai - Time Series with H2O Driverless...Sri Ambati
This session was recorded in San Francisco on February 5th, 2019 and can be viewed here: https://youtu.be/0pvvDHfxdZ8
Driverless AI is H2O.ai's latest flagship product for automatic machine learning. It fully automates some of the most challenging and productive tasks in applied data science such as feature engineering, model tuning, model ensembling and model deployment. Driverless AI turns Kaggle-winning grandmaster recipes into production-ready code, and is specifically designed to avoid common mistakes such as under- or overfitting, data leakage or improper model validation, some of the hardest challenges in data science. Avoiding these pitfalls alone can save weeks or more for each model, and is necessary to achieve high modeling accuracy.
Driverless AI is now equipped with time-series functionality. Time series helps forecast sales, predict industrial machine failure and more. With the time series capability in Driverless AI, H2O.ai directly addresses some of the most pressing concerns of organizations across industries for use cases such as transactional data in capital markets, in retail to track in-store and online sales, and in manufacturing with sensor data to improve supply chain or predictive maintenance.
Bio: Marios Michailidis is a Competitive Data Scientist at H2O.ai. He holds a Bsc in accounting Finance from the University of Macedonia in Greece, an Msc in Risk Management from the University of Southampton and a PhD in machine learning at from UCL . He has worked in both marketing and credit sectors in the UK Market and has led many analytics’ projects with various themes including: acquisition, retention, recommenders, fraud detection, portfolio optimization and more. He is the creator of KazAnova, a freeware GUI for credit scoring and data mining 100% made in Java as well as is the creator of StackNet Meta-Modelling Framework. In his spare time he loves competing on data science challenges and was ranked 1st out of 500,000 members in the popular Kaggle.com data competition platform. He currently ranks 3rd.
Bio: A Kaggle Grandmaster and a Data Scientist at H2O.ai, Mathias Müller holds an AI and ML focused diploma (eq. M.Sc.) in computer science from Humboldt University in Berlin. During his studies, he keenly worked on computer vision in the context of bio-inspired visual navigation of autonomous flying quadrocopters. Prior to H2O.ai, he as a machine learning engineer for FSD Fahrzeugsystemdaten GmbH in the automotive sector. His stint with Kaggle was a chance encounter as he stumbled upon the data competition platform while looking for a more ML-focused platform as compared to TopCoder. This is where he entered his first predictive modeling competition and climbed up the ladder to be a Grandmaster. He is an active contributor to XGBoost and is working on Driverless AI with H2O.ai.
Monitoring your App in Kubernetes with PrometheusLuke Marsden
This talk gives an introduction to the Prometheus data model and PromQL, building up a simple PromQL expression and explaining what's happening under the hood at each stage. The architecture of Prometheus is shown as well as its limitations, and a distributed version of Prometheus, Weave Cortex, is proposed. Finally, an explanation of how Kubernetes and Prometheus have sympathetic designs is given.
The Prediction Of Time Trending Techniques. Is It A Reasonable Estimate?Gan Chun Chet
Time prediction (modelling) techniques use to analyze machine setup (performance) time. These time series techniques are compared with probability and categorization method, found to be coherent.
Also with reference to Noise Prevention in Factories training dated 20 March 2012 at IEM Penang (noise calculation).
International Journal of Computational Engineering Research (IJCER) ijceronline
International Journal of Computational Engineering Research(IJCER) is an intentional online Journal in English monthly publishing journal. This Journal publish original research work that contributes significantly to further the scientific knowledge in engineering and Technology
Multiphysics Modeling of Induction Machines_Jd'12 presMellah Hacene
in this paper we interest to how we can validate simultaneously a thermal model and estimated variable of induction motor. This approach is possible by using special simulation package frequently exploited bout in university and industry. A simple description of each one of this famous software is presented.
According to our needs and means; I took a justified choice of the used software in this validation context. In this moment, I make
only the modeling of an induction machine without takes into account the heating effects. Same simulation results of induction
motor model by Maxwell software is given and commented.
2. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
In this chapter we’ll
• Learn how to manipulate matrices
• Solve problems with two variables
• Explore some of the special
matrices built into Matlab
3. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Section 4.1
Manipulating Matices
• We’ll start with a brief review
• Define a matrix type in a list of
numbers enclosed in square
brackets
4. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Remember that we can define a
matrix using the following syntax
• A=[3.5]
• B=[1.5, 3.1] or
• B=[1.5 3.1]
• C=[-1, 0, 0; 1, 1, 0; 0, 0, 2];
5. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
2-D Matrices can also be entered by
listing each row on a separate line
C = [-1, 0, 0
1, 1, 0
1, -1, 0
0, 0, 2]
6. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
F = [1, 52, 64, 197, 42, -42, …
55, 82, 22, 109];
Use an ellipsis to continue a
definition onto a new line
14. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
If you add an element
outside the range of the
original array, intermediate
elements are added with a
value of zero
15. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Colon Operator
• Used to define new matrices
• Modify existing matrices
• Extract data from existing
matrices
16. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Evenly spaced vector
The default spacing is 1
17. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
User specified spacing
The spacing is specified as 0.5
18. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The colon can be used to represent
an entire row or column
All the rows in column 1
All the rows in column 4
All the columns in row 1
19. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
You don’t need to extract an
entire row or column
Rows 2 to 3, all the
columns
20. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Or…
Rows 2 to 3, in
columns 4 to 5
21. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
A single colon transforms the
matrix into a column
Matlab is column dominant
22. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Indexing techniques
• To identify an element in a 2-D
matrix use the row and column
number
• For example element M(2,3)
23. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Element M(2,3) is in row
2, column 3
24. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Or use single value
indexing
M(8) is the same
element as M(2,3)
1 4 7 10 13
2 5 8 11 14
3 6 9 12 15
Element #s
25. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The word “end” signifies the last
element in the row or column
Row 1, last element
Last row, last element
Last element in the
single index
designation scheme
27. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Section 4.2
Problems with Two Variables
• All of our calculations thus far
have only included one variable
• Most physical phenomena can
vary with many different factors
• We need a strategy for
determining the array of answers
that results with a range of values
for multiple variables
28. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Two scalars give a scalar
result
29. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
A scalar and a vector give a
vector result
30. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
When you multiply two vectors
together, they must have the same
number of elements
31. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Array multiplication gives a result
the same size as the input arrays
x and y must be
the same size
32. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Results of an element by element
(array) multiplication
x
1 2 3 4 5
y 1.0 1
1.5 3
2.0 6
2.5 10
3.0 ? 15
33. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The meshgrid function maps
two vectors onto a 2-D grid
34. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Now the arrays are the same size,
and can be multiplied
36. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Example 4.2
Distance to the Horizon
Radius
of the
earth
Distance to
the horizon Height of the
mountain
Radius of the
earth, R
Radius plus the
height of the
mountain, R+h
Distance to the
horizon, d
37. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
State the problem
• Find the distance to the horizon
from the top of a mountain on the
moon and on the earth
38. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Describe the Input and
Output
• Input
• Radius of the Moon 1737 km
• Radius of the Earth 6378 km
• Mountain elevation 0 to 8000km
• Output
• Distance to the horizon in km
39. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Hand Example
Rhhd 22
+=
Using the radius of the earth, and an 8000
meter mountain. (Remember 8000m = 8 km)
kmkmkmkmd 3198*6378*2)8( 2
=+=
222
)( hRdR +=+ Pythagorean theorum
Solve for d
42. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Test the Solution
• Compare the results to the hand
solution
43. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Section 4.3
Special Matrices
• zeros
• Creates a matrix of all zeros
• ones
• Creates a matrix of all ones
• diag
• Extracts a diagonal or creates an identity
matrix
• magic
• Creates a “magic” matrix
44. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
With a single input a square matrix is
created with the zeros or ones
function
45. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Two input arguments specify the
number of rows and columns
46. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The diag function
When the input
argument to the
diag function is
a square matrix,
the diagonal is
returned
47. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The diag function
When the input is a vector, it is used as
the diagonal of an identity matrix
49. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
This woodcut
called
Melancholia was
created by
Albrect Durer, in
1514. It contains
a magic matrix
above the
angel’s head
50. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Albrect
Durer
included
the date in
this magic
matrix.
51. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
The Durer matrix is different from
Matlab’s 4x4 magic matrix
Durer switched these
two columns to make
the date work out
52. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Summary
• Matrices can be created by
combining other matrices
• Portions of existing matrices can
be extracted to form smaller
matrices
53. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Summary – The colon
operator
• The colon operator
• can be used to create evenly
spaced matrices
• can be used to extract portions of
existing matrices
• can be used to transform a 2-D
matrix into a single column
54. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Summary - Meshgrid
• Meshgrid is an extremely useful
function that can be used to map
vectors into two dimensional
matrices
• This makes it possible to perform
array calculations with vectors of
unequal size
55. Matlab for Engineers
100 200 300 400 500
100
200
300
400
500
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-5
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Rate of Change
time, hour
Rateoftemperaturechange,degrees/hour
Summary – Special Matrices
• zeros – creates a matrix composed of
all zeros
• ones – creates a matrix composed of
all ones
• diag – extracts the diagonal from a
square matrix or can be used to create
a square matrix identity matrix
• magic – creates a “magic matrix”