Driving Efficiency with MATLAB and Simulink · and Simulink The Commodore Hotel ... • Editing and...
Transcript of Driving Efficiency with MATLAB and Simulink · and Simulink The Commodore Hotel ... • Editing and...
Driving Efficiency with MATLAB and Simulink
The Commodore Hotel– 20 June 2017
Welcome
Danielle Winter
Application Engineer
Praneet Kala
Application Engineer
Please put cell phones on silent
Please fill in the evaluation forms
2Driving Efficiency with MATLAB and Simulink
Opti-Num Solutions and MathWorks
Driving Efficiency with MATLAB and Simulink 3
Opti-Num Solutions
Sales
Application Engineering
TrainingConsulting
Development
Why Are We Here?
How proficient are you in MATLAB and Simulink?
Driving Efficiency with MATLAB and Simulink 4
Agenda
Driving Efficiency with MATLAB and Simulink 5
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Q&A 11:30 – 12:00
Efficiency Updates in MATLAB
• Increased performance
• New graphics system
• Editing and running code
• New data types
• Working with Big Data
• Language enhancements
• Toolbox enhancements
Driving Efficiency with MATLAB and Simulink 6
Increased Performance
• Redesigned MATLAB execution engine
– All MATLAB code is now JIT compiled
– Average performance improvement of 40%
Driving Efficiency with MATLAB and Simulink 7
New Graphics System
• Easier plot customization with objects
– Graphics objects with graphics handles
– Support dot-notation to access and change properties
– Object-specific properties
• Updates and Enhancements
– Automatic update of datetime tick labels
– Dynamic legends
– Plot with categoricals
– Multiple colormaps per figure
8Driving Efficiency with MATLAB and Simulink
Editing and Running MATLAB Code Pre-16a
• Plain-text editing
• Output goes to Command Window
• Multiple figure windows appear
• Equations, images, and hyperlinks only appear if published
Driving Efficiency with MATLAB and Simulink 9
• Run code, present, share, and collaborate using interactive documents
– Rich text formatting
– Interactive plot customizationwith code generation
– Interactive equation editing
– Insert images
– Hyperlinking
• See results together with code
– Side-by-side or inline views
• Save directly to PDF or HTML
Live Editor
Driving Efficiency with MATLAB and Simulink 10
Importing and Exporting Data
• Import improvements
– Improved performance
– Improved format detection in readtable and datastore
– Advanced control over import with detectImportOptions
• Import Tool
• Datastore
– Importing multiple files
– Text, spreadsheet, images, and custom
• Access online data
– RESTful, JSON, HTTP, CSV, text, and image data
Driving Efficiency with MATLAB and Simulink 11
Automatic MATLAB Code Generation
• Customized data import
• Recreate customized plots
– Directly from figures
– Within Live Editor
– Plot Gallery
• Variable Editor actions
• Apps in Toolboxes generate codefor more complex workflows
Driving Efficiency with MATLAB and Simulink 12
Data Types in MATLAB
Numeric
datetime duration
calendarDuration
logical categorical
cellstructure table
Heterogeneous
Text
double, single, …
char
c|h
timetable
string
strcell string
{c|h}
str
str
str
str
tall
Driving Efficiency with MATLAB and Simulink 13
Tables
• For mixed-type tabular data
– Holds both data and metadata
• Flexible indexing
• Built-in functionality(merge, sort, etc.)
• Database-like functionality
– Join
– Stack / Unstack
Driving Efficiency with MATLAB and Simulink 14
Date and Time Arrays
• datetime for representing a point in time
• duration, calendarDuration
for representing elapsed time
• Same data type for computation and display
– Add, subtract, sort, compare, and plot
– Customize display formats
• Support for time zones and leap seconds
– Accounts for daylight saving time
Driving Efficiency with MATLAB and Simulink 15
Timetables
• Manage time-stamped tabular data with time-based indexing
• Use dedicated functions to manage timetables
– Reorganize data
– Evenly space data by time
– Synchronise multiple data sets
Driving Efficiency with MATLAB and Simulink 16
Strings
• Manipulate, compare, and store text data efficiently
• Simplified text manipulation functions
• Performance improvement
– Up to 50x faster
– Up to 2x memory savings
Driving Efficiency with MATLAB and Simulink 17
Previously Now
String concatenation
Matrix dimensions must agree for character array addition
>> "image" + (1:3) + ".png"
1×3 string array
"image1.png" "image2.png“
"image3.png“
Text manipulation if
~isempty(strfind(textdata,
"Dog"))
if contains(textdata,"Dog")
Working with Big Data just goteasier in MATLAB.
Driving Efficiency with MATLAB and Simulink
Machine
Memory
Tall Arrays
• Applicable when:
– Data is columnar – with many rows
– Overall data size is too big to fit into memory
– Operations are mathematical/statistical in nature
• Statistical and machine learning applications
– Hundreds of functions supported in MATLAB andStatistics and Machine Learning Toolbox
Tall Data
Driving Efficiency with MATLAB and Simulink 19
Run in parallel on Spark clustersMATLAB Distributed Computing Server
Deploy MATLAB applications as standalone applications on Spark clustersMATLAB Compiler
Run in parallel on compute clustersMATLAB Distributed Computing Server
Tall arraysBuilt into base MATLAB
100’s of functions supported
Run in parallelParallel Computing Toolbox
Using Tall Arrays
Spark + Hadoop
Compute ClustersLocal diskShared folders
Databases
Driving Efficiency with MATLAB and Simulink 20
Programming Flexibility
• Functions in scripts
– Define local functions in scripts for improved code reuse and readability
• Property validation for classes
– Easily control a property's size, class, and value
Driving Efficiency with MATLAB and Simulink 21
Expressing Math More Naturally with Implicit Expansion
A = bsxfun(@minus,A,mean(A))
A = A – mean(A)
[nr,nc] = size(A)A = A – ones(nr,1)*mean(A)
1986:
1996:
2006:
A = A – repmat(mean(A),nr,1)
2016:
% Remove mean of each column:
Driving Efficiency with MATLAB and Simulink 22
Data Preprocessing
• Text manipulation functions– contains, endsWith, and others
• Find, fill, and remove missing data– *missing functions
• Options to ignore “NaNs” with cumulative statistic functions
• Smooth noisy data with filtering or local regression using smoothdata
• Deal with outliers easily using isoutlier and filloutliers
Driving Efficiency with MATLAB and Simulink 23
Analyse Data
• Split-Apply-Combine Workflow – findgroups – splits the data into groups
– splitapply – applies a function to each group,and combines the results
• Apply functions with tables and timetables using varfun
Driving Efficiency with MATLAB and Simulink 24
Statistics and Machine Learning Toolbox
• Easy-to-use Apps
– Classification Learner App
– Regression Learner App
• 1-click parallel computing
• Big data using tall arrays
• C code generation for predictive models(requires MATLAB Coder)
Driving Efficiency with MATLAB and Simulink 25
Deep Learning with Neural Network Toolbox
• Import forward-looking models from Caffe
• Extract features from a trained network
• Construct convolutional neural network (CNN) architecture
• Train and test using CPUs or multiple GPUs
• Perform transfer learning with AlexNet, VGG-16, VGG-19
Driving Efficiency with MATLAB and Simulink 26
Parallel Computing Toolbox
• tall array support for big data
• Measure data sent to workers using ticBytes and tocBytes
• Cloud offerings with K80-equipped GPUs
• Send data to client using DataQueue and PollableDataQueue
• Train a single deep learning network with multiple CPUs or multiple GPUs
Driving Efficiency with MATLAB and Simulink 28
Other Toolbox Enhancement Highlights
• Optimization Toolbox– Mixed Integer Linear Programming
• Database Toolbox– Analyze large data using a Database Datastore and tall table capabilities– Retrieve graph data from Neo4j Graph Database
• Econometrics Toolbox– Bayesian Linear Regression– Vector Autoregressive Models (VAR) with Exogenous Inputs (VARX)
• MATLAB Report Generator– Document Object Model (DOM) API for creating customized reports
• Signal Processing Toolbox– Signal Analyser App for spectral and time domain analysis of signals
Driving Efficiency with MATLAB and Simulink 29
Efficiency Updates in MATLAB
• Increased performance
• New graphics system
• Editing and running code
• New data types
• Working with Big Data
• Language enhancements
• Toolbox enhancements
Driving Efficiency with MATLAB and Simulink 30
Agenda
Driving Efficiency with MATLAB and Simulink 31
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Q&A 11:30 – 12:00
Connecting the blocks …
• Graphical programming environment for modelling, simulating and analysing multi-domain dynamic systems
32
Building
Simulating
Analysing
Managing
Connecting
Simulation Data Inspector
• Inspect and compare simulation data
• Compare simulation outputs for different inputs when testing your model
• Compare simulation outputs and generated code outputs
Driving Efficiency with MATLAB and Simulink 33
Dashboard Block Library
Tune and test your simulations with graphical controls and displays
• New library of controls and displays, including knobs, switches, and gauges
• Place blocks directly within the Simulink Editor
• Provide a front-end user interface to the entire model
Driving Efficiency with MATLAB and Simulink 34
Driving Efficiency with MATLAB and Simulink 35
New Scope Interface
• Control model from scope
• Trigger repeating signals
• View and debug signals with cursors
and measurements
• Auto scaling and data range tools
Driving Efficiency with MATLAB and Simulink 36
Quick Insert Feature
• Add blocks to models without using Simulink Library Browser
• Click in white space and start typing
• Lists all possible blocks and the location of block
Driving Efficiency with MATLAB and Simulink 37
Property Inspector
• Edit parameters of block using a single interface
• Always open and docked
Driving Efficiency with MATLAB and Simulink 38
Ctrl+Shift+i
Initialize and Terminate Function Blocks
• Model dynamic start-up and shutdown behaviour
• Respond to events by changing states
• Generate code from these functions
Driving Efficiency with MATLAB and Simulink 39
General Simulink Editor Enhancements
• Reduced Bus Wiring
• Automatic Port Creation
• Inport File Streaming
• Dashboard Block Connection Indicators
• One Click Display
Driving Efficiency with MATLAB and Simulink 40
Parallel Computing Toolbox and Simulink
• Directly run multiple parallel simulations from the parsim command
• Iteratively change various parameter values in your model
• Common use cases for this approach include:
– Model testing
– Design of experiments
– Monte Carlo runs
– Sensitivity and robustness analysis.
• Custom code required is reduced significantly compared to sim command
Driving Efficiency with MATLAB and Simulink 41
New Toolboxes
• Automated Driving System Toolbox
• Robotics System Toolbox
• Audio System Toolbox
• Vision HDL Toolbox
• Simulink Test
• Risk Management Toolbox
• Simscape Fluids
• Antenna Toolbox
• Phased Array System Toolbox
• WLAN System Toolbox
• LTE System Toolbox
– 5G library for LTE available
Driving Efficiency with MATLAB and Simulink 42
Agenda
Driving Efficiency with MATLAB and Simulink 43
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Q&A 11:30 – 12:00
Agenda
Driving Efficiency with MATLAB and Simulink 44
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Q&A 11:30 – 12:00
Demonstration
• Importing data into MATLAB
• Automatic MATLAB code generation
• Tables
• Datetimes
• Strings
• Categorical data
• Data pre-processing and analysis
• Debugging code
45
Code Debugging
• Set and remove breakpoints
• Enter debug mode
• Interactively view and change variables
• Resume program execution
Driving Efficiency with MATLAB and Simulink 46
External Interfaces
Calling Libraries Written in Another Language From MATLAB
Calling MATLAB from Another Language
• Python• C/C++• Fortran• Java• COM components and ActiveX®
controls• RESTful, HTTP, and WSDL web services
• Java• Python• C/C++• Fortran• COM Automation server
Driving Efficiency with MATLAB and Simulink
Test Frameworks
• How would you check that this data is the same?
Driving Efficiency with MATLAB and Simulink 48
Test Frameworks
• MATLAB Unit Testing Framework
– Test your code early and often
– Script / function / class based testing
– Works with continuous integration servers
– Automatic reporting
– Mocking framework
• Performance Testing Framework
– Time MATLAB code automatically
– Track performance over time
Driving Efficiency with MATLAB and Simulink 49
Source Control Integration
• Manage your code from withinthe MATLAB Desktop
• GIT and Subversion integration in Current Folder browser
• Use Comparison Tool to view andmerge changes between revisions
Driving Efficiency with MATLAB and Simulink 50
Agenda
Driving Efficiency with MATLAB and Simulink 51
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Q&A 11:30 – 12:00
Simulink Driving Efficiency
Are you using the tools effectively?
Are all your files neatly stored in one folder?
Is your model and configuration data stored in one place?
Do you have different variations of models to be tested?
Are you over the budget due to expensive hardware?
Driving Efficiency with MATLAB and Simulink 52
?
? ?
?
Simulink Projects
• Create new project from Home tab
• Organise all project related models and data in one place
• Metadata– Shortcuts
– Folders
• Interface– Start up and Shutdown scripts
• Source Control Integration
Driving Efficiency with MATLAB and Simulink 53
Airframe Example
Simulink Project and Dependency Analysis
Driving Efficiency with MATLAB and Simulink 54
Data Dictionary
• Get model data from a different source other than the workspace
• Keep all configuration data and design data in one place
• Can reference each model to particular Data Dictionary
• Built in change tracking
Driving Efficiency with MATLAB and Simulink 55
Model References
• Develop referenced model independently
• Reference a model multiple times without making redundant copies.
• Multiple models can reference a single model.
• The referenced model is not loaded until it is needed (Incremental Loading)
– Speeds up model load times.
Driving Efficiency with MATLAB and Simulink 56
Variants – add/copy variant
• Different variations of model in one model
• Useful for switching components between simulations
• One variant is always active
• For code generation only the active variant is compiled
Driving Efficiency with MATLAB and Simulink 57
Simulink Project Upgrade
• Easily upgrade all your models in your project to a new version
• Upgrade to latest release using a simple workflow
• Can apply all fixes automatically when possible
• Upgrade all model hierarchies in the project at once
• Automatically produces a report
Driving Efficiency with MATLAB and Simulink 58
Recap
• Efficiency Updates
• Simulink Projects
• Data Dictionaries
• Model References
• Variants
• Simulink Project Upgrade
59Driving Efficiency with MATLAB and Simulink
Hardware Support
• Raspberry Pi, Arduino, BeagleBone, Lego EV3
• Data and RF and speciality hardware
• Webcams
• Android and iOS Sensors
• Download Support Packages with the Add-On Explorer
– Installs both the code and the drivers needed
Driving Efficiency with MATLAB and Simulink 60
IoT - ThingSpeak
• Collect data from internet-connectedsensors and run MATLAB analyticson the cloud using functions from:
– Statistics and Machine Learning Toolbox
– Signal Processing Toolbox
– Curve Fitting Toolbox
– Mapping Toolbox
Driving Efficiency with MATLAB and Simulink 61
Agenda
62
Efficiency Updates in MATLAB 09:00 – 09:40
Efficiency Updates in Simulink 09:40 – 10:00
Tea Break 10:00 – 10:30
Driving Efficiency in MATLAB 10:30 – 11:10
Driving Efficiency in Simulink 11:10 – 11:30
Recap and Questions and Answers 11:30 – 12:00
Driving Efficiency with MATLAB and Simulink
Why Are We Here?
How proficient can you be in MATLAB and Simulink?
Driving Efficiency with MATLAB and Simulink 63
Opti-Num Solutions philosophy
• “Walking the journey” with our
clients
• Focus on the business problem
• Passionate about data, technology
and the development
of creative solutions to practical
problems.
Driving Efficiency with MATLAB and Simulink 64
Opti-Num Solutions philosophy
Driving Efficiency with MATLAB and Simulink 65
Consulting
Training
ProductsGet the tools you need
Learn how to use them
Let us accelerate your development
Get the tools you need
66
Consulting
Training
Products
Driving Efficiency with MATLAB and Simulink
• Maximise value
• Take advantage of features you requested
• Increase workflow efficiency
• Build confidence in your designs
• Save time by upgrading regularly
• Two releases annually
• Access to technical support
Consulting
Training
Products
Learn how to use them
67
See all training courses
Driving Efficiency with MATLAB and Simulink
Training by Learning Path
Driving Efficiency with MATLAB and Simulink
Consulting
Training
Products • Tailored learning for your knowledge area and application
• Computational Finance• Data Analytics• Image Processing and Computer Vision• Programming and Application Development
68
Let us accelerate your development
69
• Partner with customers to
combine domain knowledge with
tools expertise
• Code reviews
• Model-Based Design projects
• Knowledge transfer
• Flexible business models
• Ongoing relationshipsConsulting
Training
Products
Driving Efficiency with MATLAB and Simulink
OPTI-NUM solutions Consulting Services
70
Capital adequacy projection model and macro-economic factor model
MTN Zone product discount strategy application (ongoing)
Rand Merchant Bank, Credit RiskProperty development risk model (ongoing)
Short term load forecasting
Power generation dispatch modelling, simulation and optimization (ongoing)
Modelling, software and hardware-in-the-loop simulation of a mechanised air defence system
Operational process monitoring application
Data Acquisition Toolbox support for Keithley and Advantech data acquisition hardware
Traffic modelling for cell congestion analysis
&
MATLAB Ramp-Up Consulting Assistance for Fault Prediction Analysis
Portfolio optimisation framework design and implementation
Research, design and implementation of a framework and algorithm for a human biometrics machine learning project
Driving Efficiency with MATLAB and Simulink
Consulting
Training
Products
Our Business Model
71
“A staggered code development and deployment approach allowed benefits to be realised well before the end of the project, with clear, comprehensive documentation ensuring swift adoption of the new functionality..”
• - D Groenewald, Anglo American Platinum
Driving Efficiency with MATLAB and Simulink
Next Steps
• MathWorks website pages– MathWorks Discovery Page
– MathWorks Solutions
– MATLAB updates
– Simulink updates
• Get support for your trial – [email protected]
• Opti-Num Website– Training learning paths
• Please fill in the feedback form
Driving Efficiency with MATLAB and Simulink 72
Thank You for Attending
Driving Efficiency with MATLAB and Simulink 73
Questions & Answers