SlideShare a Scribd company logo
1© 2014 The MathWorks, Inc.
Modellbildung, Berechnung und Simulation
in Forschung und Lehre
Dr. Joachim Schlosser
MathWorks
Simulation im Computer Aided Engineering,
HFT-Stuttgart, 4.7.2014
With material from Dr. Mischa Kim, Dr. Rainer Muemmler
2
“There is no correlation between
experimenting and learning outcome, in general.” §
“Experimenting does improve learning outcome,
if supported by a didactic framework.” §
Not if, but how…
§ e.g. D. R. Sokoloff and R. K. Thornton, Using Interactive Lecture Demonstrations to Create an
Active Learning Environment. The Physics Teacher, September, 1997, Vol. 35, pp. 340-347.
3
“Experiments…
• Activate knowledge, thereby
• Support the learning process
• Foster competences and
• Motivate students” §
The Why’s
§ e.g. M Hopf, H Schecker, H Wiesner, Physik allgemein / Physkdidaktik kompakt.
4
About
Learningand
Teaching
5
Experiments are time consuming.
1. Prep work (instructor)
2. Pre-experiment
3. Experiment
4. Post-experiment
5. Evaluation
The How’s
MATLAB & Simulink Very important
Immensely important
Typically over-emphasized
6
Hardware connectivity
Symbolic Numeric
Optimization
Control System
Graphic, physical
Modeling
Simscape
StateFlow
Simulink
MATLAB
Simulink and Simscape blocks
MATLAB function
Publishing
Symbolic
Experiment implementation: the sky’s the limit
1
1
1
1
2
2
2
2
7
The solution landscape: a matter of perspective
MATLAB (symbolic)
Simulink
Simscape
MATLAB (numeric)
Publishing
MATLAB and H/W
convert
convert
convert
8
RLC series circuit: problem statement
9
RLC series circuit: solution and analysis
10
Resources to get you started
>> doc
MATLAB
Courseware
MATLAB Central
info/code hub
11
Online experimenting: Cody Coursework Problem
Solution
Feedback
 Create MATLAB problem sets
 Grade based on test suites (automated!)
 Assess class progress
 Detect plagiarism and proctor exams
 Use 1300+ autograde-ready MATLAB
programming problems
12
Hardware for experiments
Support package only req’d Additional toolboxes req’d
Raspberry Pi
LEGO Mindstorms
NXT and EV3
Arduino
Samsung Galaxy, iPhone
Altera DE2-
115
Freescale Freedom
Digilent’s
Analog
Discovery
 Find hardware for your application
…plus many more…plus many more
Microsoft
Kinect
NI
CompactDAQ
13
 Retain the right students, on-time: STEOP
 Integrate Spiraling Curricula
Standardized Tool in Curricula
14
Key takeaways
 Experiments can foster the learning progress.
Use with care.
 Experiments develop competences.
 MathWorks provides tools and resources for your support.
15
Challenge
Teach mathematics and mathematical modeling to
students across multiple disciplines and two universities,
and prepare them to meet the needs of industry
Solution
Integrate MATLAB throughout the core mathematics
curriculum and provide interdisciplinary exercises in
practical problem-solving
Results
 Interdepartmental collaboration improved
 Students taught skills required by industry
 Students self-identified as expert users
Chalmers University of Technology
Integrates MATLAB Throughout Core
Mathematics Curriculum
Chalmers University in Gothenburg, Sweden.
Link to user story
“We train our students to use
MATLAB as an interactive tool not
only for completing the assigned
exercises but also for investigating
mathematical problems and having
fun. We are increasing our focus
on interdisciplinary programs, and
MATLAB is perfect for integrating
mathematics with other subjects.”
Dr. Tommy Gustafsson
Chalmers University of Technology
16
University of Applied Sciences Augsburg
Students Develop and Simulate Advanced
Robotic Control Systems
Challenge
Enable students to participate in the development of
advanced robotic control software
Solution
Integrate MathWorks tools into exercises in modeling
robotic systems and implementing control software
Results
 Programming skills quickly acquired
 Reusable robotic control components developed
 Students’ transition to industry eased
“When I teach C++, I show students a
program that simulates a swing. The C++
program is seven pages of code or more.
The MATLAB implementation is a single
page —about 50 lines of well-structured,
compact code that is easy to
understand.”
Professor Georg Stark
University of Applied Sciences Augsburg
Link to user story
Professor Stark with students in the lab.
17
Technische Universität München Uses
Model-Based Design to Drive Research,
Problem-Based Learning, and Industry
Collaboration
Challenge
Enable problem-based learning of flight dynamics
and cost-effective implementation of flight control
systems
Solution
Use MathWorks tools for Model-Based Design to
simulate designs, conduct real-time tests, and
develop realistic flight simulators
Results
 Students prepared for a variety of careers
 Motivation increased and learning accelerated
 Collaboration with industry partners strengthened
“Flight controls and flight system dynamics are
multidomain engineering disciplines. MathWorks
tools enable our students to build upon our
fundamental research to develop solutions that fly
in real aircraft. With Model-Based Design we can
close the gap between the theoretical foundation
and the practical application, and that is how we
measure success.”
Dr. Florian Holzapfel
Technische Universität München
Link to user story
Professor Holzapfel, research fellow Markus Hornauer,
and a student test flight control algorithms in the
Research Flight Simulator.
19
20
And what about
Specialties in
Research?
21
Festo Develops Innovative Robotic Arm
Using Model-Based Design
Challenge
Design and implement a control system for a pneumatic
robotic arm
Solution
Use Simulink and Simulink PLC Coder to model, simulate,
optimize, and implement the controller on a programmable
logic controller
Results
 Complex PLC implementation automated
 Technology and innovation award won
 New business opportunities opened
“Using Simulink for Model-Based Design enables us to
develop the sophisticated pneumatic controls required
for the Bionic Handling Assistant and other
mechatronic designs. With Simulink PLC Coder, it is
now much easier to get from a design to a product.”
Dr. Rüdiger Neumann
Festo
Link to user story
The Festo Bionic Handling Assistant.
Image © Festo AG.
22
All of the previous applies.
23
But you process more data.
Much more data.
24
Max Planck Institute Reconstructs Key
Protein Complexes Using MATLAB and
Parallel Computing Toolbox
Challenge
Develop high-quality 3D images of protein complexes
Solution
Use MathWorks tools to acquire, analyze, filter, combine,
and display electron microscope images
Results
 Research time cut by years
 Development time cut from weeks to days
 Workflow accelerated
“Parallel Computing Toolbox enabled us
to speed up our processing by 20 to 30
times. We were able to use our cluster
productively from the MATLAB
environment without having to be experts
in parallel programming or having to learn
another programming language.”
Andreas Korinek
Max Planck Institute of Biochemistry
Schematic of the 26S proteasome.
Link to user story
26
Challenges with Large Data
 “Out of memory”
 Slow processing
– Data too large to be efficiently managed between RAM and virtual
memory
– Lots of data
 Gaining insight
– Large data visualization
– Modeling with no equation and lots of predictors
27
Data Copies
Function calls
 Data is “copy-on-write” (lazy-copy)
 Passed by reference into the function
function y = foo(x,a,b)
y = a * x + b;
end
function y = foo(x,a,b)
a(1) = a(1) + 12;
y = a * x + b;
end
a not copied
a is copied
Is not modified, no copy is made Is modified, a temporary copy is made
28
Data Copies
In-Place Optimizations
 MATLAB perform calculations “in-place” when:
– Output variable name is the same as input variable name
– Performing element-wise computation
not in-place
y = 2*x + 3;
x = 2*x + 3;
in-place
29
Sparse Matrices
 Require less memory and are faster
 When to use sparse?
< 1/2 dense on 64-bit (double precision)
< 2/3 dense on 32-bit (double precision)
 Functions that support sparse matrices
>> help sparfun
 Blog Post: Creating Sparse Finite Element Matrices
blogs.mathworks.com/loren/2007/03/01/creating-sparse-finite-element-matrices-in-matlab/
30
Categorical Arrays
Ordinal and Nominal Arrays
 Memory-efficient data container for values
drawn from a finite, discrete set of categories
 Nominal arrays
– No ordering in the levels
 Ordinal arrays
– Ordering in the levels
Available from
 Statistics Toolbox
31
Vectorization and Memory Tradeoffs
 Use bsxfun to limit creating intermediate matrices
– Applies element-wise binary operation with singleton expansion
 Consider using several smaller matrices for processing
– Keep within the limits of contiguous memory
– Process with for loops (i.e. de-vectorize)
– Slower runtime but will use less memory
– Operate on data by column for best performance
N x M+,*N x 1
1 x M
=
Element-wise
operation
32
Processing Large Data Sets
 Break your large data into separate pieces
and process independently
– Partial reading and writing of files
– Built-in functionality for block-processing
– System Objects for stream processing
 Use the whole dataset at once
– Single array across memory of multiple machines
33
Reading in Part of a Dataset from Files
 ASCII file
– Import Tool , textscan
 MAT file
– Load and save part of a variable using the matfile
 Binary file
– Read and write directly to/from file using memmapfile
– Maps address space to file
 Databases
– ODBC and JDBC-compliant (e.g. Oracle, MySQL, Microsoft, SQL Server)
– Database Explorer App
34
Block Processing Images
 blockproc automatically divides an
image into blocks for processing
 Reduces memory usage
– Read and write block directly from image file
 Processes arbitrarily large images
Available from
 Image Processing Toolbox
35
Batch processing…
Load the entire file and process it all at once
Stream processing
Load a frame and process it before moving on to the next frame
Source
Batch
Processing
Algorithm
Memory
MATLAB Memory
Stream
Source
Stream
Processing
36
System Objects
 A class of MATLAB objects that support streaming workflows
 Simplifies data access for streaming applications
 Contain algorithms to work with streaming data
Available from
 DSP System Toolbox
 Communications System Toolbox
 Computer Vision System Toolbox
 Phased Array System Toolbox
 Image Acquisition Toolbox
37
Distributed Array
Lives on the Workers
Remotely Manipulate Array
from Client
11 26 41
12 27 42
13 28 43
14 29 44
15 30 45
16 31 46
17 32 47
17 33 48
19 34 49
20 35 50
21 36 51
22 37 52
Distributing Large Data
Worker
Worker
Worker
Worker
MATLAB
Desktop (Client)
Available from
 Parallel Computing Toolbox
 MATLAB Distributed Computing Server
39
 Offload computation:
– Free up desktop
– Access better computers
 Scale speed-up:
– Use more cores
– Go from hours to minutes
 Scale memory:
– Utilize distributed arrays
– Solve larger problems without re-coding algorithms
Cluster
Computer Cluster
Scheduler
Take Advantage of Cluster Hardware
MATLAB
Desktop (Client)
40
 On bw|HPC-C5
 Installed on Grid Nodes KIT, Freiburg, Tübingen
 Supported by MathWorks Pilot Team: install, documentation, usage
 Also on bwGRiD
 Installed on Grid Nodes Ulm/Konstanz, Mannheim, Tübingen
43
Benchmarking Ab on EC2
 Using Amazon EC2's
cluster compute instances
 A up to 290 GB
 Good desktop machine
 4-20 GB of RAM
 20-60 Gigaflops
 Up to 1.3 Teraflops,
over a 20X improvement
45
Technical Resources
 MATLAB documentation User’s Guide
Programming Fundamentals  Software Development  Memory Usage
 The Art of MATLAB, Loren Shure’s blog: blogs.mathworks.com/loren/
 Memory Management Guides
mathworks.com/support/tech-notes/1100/1106.html
mathworks.com/support/tech-notes/1100/1107.html
 MATLAB Answers: mathworks.com/matlabcentral/answers/
46

More Related Content

Similar to Modellbildung, Berechnung und Simulation in Forschung und Lehre

Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Joachim Schlosser
 
Software tools to facilitate materials science research
Software tools to facilitate materials science researchSoftware tools to facilitate materials science research
Software tools to facilitate materials science research
Anubhav Jain
 
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
tiberiusp
 
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
Pradeeban Kathiravelu, Ph.D.
 
Evaluating Machine Learning Algorithms for Materials Science using the Matben...
Evaluating Machine Learning Algorithms for Materials Science using the Matben...Evaluating Machine Learning Algorithms for Materials Science using the Matben...
Evaluating Machine Learning Algorithms for Materials Science using the Matben...
Anubhav Jain
 
Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at ScaleOrchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
Stian Håklev
 
Laboratory manual
Laboratory manualLaboratory manual
Laboratory manual
Asif Rana
 
MATLAB for Researcher Course - ATIT Academy
MATLAB for Researcher  Course - ATIT AcademyMATLAB for Researcher  Course - ATIT Academy
MATLAB for Researcher Course - ATIT Academy
Qais Yousef
 
ExaLearn Overview - ECP Co-Design Center for Machine Learning
ExaLearn Overview - ECP Co-Design Center for Machine LearningExaLearn Overview - ECP Co-Design Center for Machine Learning
ExaLearn Overview - ECP Co-Design Center for Machine Learning
inside-BigData.com
 
Developing Computational Skills in the Sciences with Matlab Webinar 2017
Developing Computational Skills in the Sciences with Matlab Webinar 2017Developing Computational Skills in the Sciences with Matlab Webinar 2017
Developing Computational Skills in the Sciences with Matlab Webinar 2017SERC at Carleton College
 
AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)
Joaquin Vanschoren
 
Introduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnIntroduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-Learn
Benjamin Bengfort
 
Cse 7th-sem-machine-learning-laboratory-csml1819
Cse 7th-sem-machine-learning-laboratory-csml1819Cse 7th-sem-machine-learning-laboratory-csml1819
Cse 7th-sem-machine-learning-laboratory-csml1819
HODCSE21
 
Building ML Pipelines with DCOS
Building ML Pipelines with DCOSBuilding ML Pipelines with DCOS
Building ML Pipelines with DCOS
QAware GmbH
 
ML crash course
ML crash courseML crash course
ML crash course
mikaelhuss
 
Resources for Teaching Undergraduate Computational Physics
Resources for Teaching Undergraduate Computational PhysicsResources for Teaching Undergraduate Computational Physics
Resources for Teaching Undergraduate Computational Physics
Amdeselassie Amde
 
Embedding Educational Design Pattern Frameworks into Learning Management Systems
Embedding Educational Design Pattern Frameworks into Learning Management SystemsEmbedding Educational Design Pattern Frameworks into Learning Management Systems
Embedding Educational Design Pattern Frameworks into Learning Management Systems
Michael Derntl
 

Similar to Modellbildung, Berechnung und Simulation in Forschung und Lehre (20)

Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
 
Teaching with MATLAB
Teaching with MATLABTeaching with MATLAB
Teaching with MATLAB
 
Software tools to facilitate materials science research
Software tools to facilitate materials science researchSoftware tools to facilitate materials science research
Software tools to facilitate materials science research
 
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
Confessions of an Interdisciplinary Researcher: The Case of High Performance ...
 
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
An Elastic Middleware Platform for Concurrent and Distributed Cloud and MapRe...
 
Evaluating Machine Learning Algorithms for Materials Science using the Matben...
Evaluating Machine Learning Algorithms for Materials Science using the Matben...Evaluating Machine Learning Algorithms for Materials Science using the Matben...
Evaluating Machine Learning Algorithms for Materials Science using the Matben...
 
Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at ScaleOrchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
 
Laboratory manual
Laboratory manualLaboratory manual
Laboratory manual
 
MATLAB for Researcher Course - ATIT Academy
MATLAB for Researcher  Course - ATIT AcademyMATLAB for Researcher  Course - ATIT Academy
MATLAB for Researcher Course - ATIT Academy
 
ExaLearn Overview - ECP Co-Design Center for Machine Learning
ExaLearn Overview - ECP Co-Design Center for Machine LearningExaLearn Overview - ECP Co-Design Center for Machine Learning
ExaLearn Overview - ECP Co-Design Center for Machine Learning
 
Developing Computational Skills in the Sciences with Matlab Webinar 2017
Developing Computational Skills in the Sciences with Matlab Webinar 2017Developing Computational Skills in the Sciences with Matlab Webinar 2017
Developing Computational Skills in the Sciences with Matlab Webinar 2017
 
AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)
 
Introduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-LearnIntroduction to Machine Learning with SciKit-Learn
Introduction to Machine Learning with SciKit-Learn
 
article_45331.pdf
article_45331.pdfarticle_45331.pdf
article_45331.pdf
 
Cse 7th-sem-machine-learning-laboratory-csml1819
Cse 7th-sem-machine-learning-laboratory-csml1819Cse 7th-sem-machine-learning-laboratory-csml1819
Cse 7th-sem-machine-learning-laboratory-csml1819
 
Building ML Pipelines with DCOS
Building ML Pipelines with DCOSBuilding ML Pipelines with DCOS
Building ML Pipelines with DCOS
 
ML crash course
ML crash courseML crash course
ML crash course
 
Resources for Teaching Undergraduate Computational Physics
Resources for Teaching Undergraduate Computational PhysicsResources for Teaching Undergraduate Computational Physics
Resources for Teaching Undergraduate Computational Physics
 
Embedding Educational Design Pattern Frameworks into Learning Management Systems
Embedding Educational Design Pattern Frameworks into Learning Management SystemsEmbedding Educational Design Pattern Frameworks into Learning Management Systems
Embedding Educational Design Pattern Frameworks into Learning Management Systems
 
Lec1
Lec1Lec1
Lec1
 

More from Joachim Schlosser

Cyber Physical Systems – Collaborating Systems of Systems
Cyber Physical Systems – Collaborating Systems of SystemsCyber Physical Systems – Collaborating Systems of Systems
Cyber Physical Systems – Collaborating Systems of Systems
Joachim Schlosser
 
Scrum für Embedded-Software: Gut – aber aus anderen Gründen, als Ihr Manager...
Scrum für Embedded-Software: Gut  – aber aus anderen Gründen, als Ihr Manager...Scrum für Embedded-Software: Gut  – aber aus anderen Gründen, als Ihr Manager...
Scrum für Embedded-Software: Gut – aber aus anderen Gründen, als Ihr Manager...
Joachim Schlosser
 
Vernetzung von Forschung und Lehre und Unternehmertum
Vernetzung von Forschung und Lehre und Unternehmertum Vernetzung von Forschung und Lehre und Unternehmertum
Vernetzung von Forschung und Lehre und Unternehmertum
Joachim Schlosser
 
Architectural Simulation of Distributed ECU Systems
Architectural Simulation of Distributed ECU SystemsArchitectural Simulation of Distributed ECU Systems
Architectural Simulation of Distributed ECU Systems
Joachim Schlosser
 
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
Joachim Schlosser
 
Simulink for Work Groups Using Simulink Projects
Simulink for Work Groups Using Simulink ProjectsSimulink for Work Groups Using Simulink Projects
Simulink for Work Groups Using Simulink Projects
Joachim Schlosser
 
Innovate with confidence – Functional Verification of Embedded Algorithms
Innovate with confidence – Functional Verification of Embedded AlgorithmsInnovate with confidence – Functional Verification of Embedded Algorithms
Innovate with confidence – Functional Verification of Embedded Algorithms
Joachim Schlosser
 
It‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
It‘s Math That Drives Things – Simulink as Simulation and Modeling EnvironmentIt‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
It‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
Joachim Schlosser
 
MathWorks and Freescale Cup - Working with MATLAB & Simulink
MathWorks and Freescale Cup - Working with MATLAB & SimulinkMathWorks and Freescale Cup - Working with MATLAB & Simulink
MathWorks and Freescale Cup - Working with MATLAB & Simulink
Joachim Schlosser
 
Effektiv lernen - Lehren mit MATLAB
Effektiv lernen - Lehren mit MATLABEffektiv lernen - Lehren mit MATLAB
Effektiv lernen - Lehren mit MATLAB
Joachim Schlosser
 

More from Joachim Schlosser (10)

Cyber Physical Systems – Collaborating Systems of Systems
Cyber Physical Systems – Collaborating Systems of SystemsCyber Physical Systems – Collaborating Systems of Systems
Cyber Physical Systems – Collaborating Systems of Systems
 
Scrum für Embedded-Software: Gut – aber aus anderen Gründen, als Ihr Manager...
Scrum für Embedded-Software: Gut  – aber aus anderen Gründen, als Ihr Manager...Scrum für Embedded-Software: Gut  – aber aus anderen Gründen, als Ihr Manager...
Scrum für Embedded-Software: Gut – aber aus anderen Gründen, als Ihr Manager...
 
Vernetzung von Forschung und Lehre und Unternehmertum
Vernetzung von Forschung und Lehre und Unternehmertum Vernetzung von Forschung und Lehre und Unternehmertum
Vernetzung von Forschung und Lehre und Unternehmertum
 
Architectural Simulation of Distributed ECU Systems
Architectural Simulation of Distributed ECU SystemsArchitectural Simulation of Distributed ECU Systems
Architectural Simulation of Distributed ECU Systems
 
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
Den Datenschatz heben und Zeit- und Energieeffizienz steigern: Mathematik und...
 
Simulink for Work Groups Using Simulink Projects
Simulink for Work Groups Using Simulink ProjectsSimulink for Work Groups Using Simulink Projects
Simulink for Work Groups Using Simulink Projects
 
Innovate with confidence – Functional Verification of Embedded Algorithms
Innovate with confidence – Functional Verification of Embedded AlgorithmsInnovate with confidence – Functional Verification of Embedded Algorithms
Innovate with confidence – Functional Verification of Embedded Algorithms
 
It‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
It‘s Math That Drives Things – Simulink as Simulation and Modeling EnvironmentIt‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
It‘s Math That Drives Things – Simulink as Simulation and Modeling Environment
 
MathWorks and Freescale Cup - Working with MATLAB & Simulink
MathWorks and Freescale Cup - Working with MATLAB & SimulinkMathWorks and Freescale Cup - Working with MATLAB & Simulink
MathWorks and Freescale Cup - Working with MATLAB & Simulink
 
Effektiv lernen - Lehren mit MATLAB
Effektiv lernen - Lehren mit MATLABEffektiv lernen - Lehren mit MATLAB
Effektiv lernen - Lehren mit MATLAB
 

Modellbildung, Berechnung und Simulation in Forschung und Lehre

  • 1. 1© 2014 The MathWorks, Inc. Modellbildung, Berechnung und Simulation in Forschung und Lehre Dr. Joachim Schlosser MathWorks Simulation im Computer Aided Engineering, HFT-Stuttgart, 4.7.2014 With material from Dr. Mischa Kim, Dr. Rainer Muemmler
  • 2. 2 “There is no correlation between experimenting and learning outcome, in general.” § “Experimenting does improve learning outcome, if supported by a didactic framework.” § Not if, but how… § e.g. D. R. Sokoloff and R. K. Thornton, Using Interactive Lecture Demonstrations to Create an Active Learning Environment. The Physics Teacher, September, 1997, Vol. 35, pp. 340-347.
  • 3. 3 “Experiments… • Activate knowledge, thereby • Support the learning process • Foster competences and • Motivate students” § The Why’s § e.g. M Hopf, H Schecker, H Wiesner, Physik allgemein / Physkdidaktik kompakt.
  • 5. 5 Experiments are time consuming. 1. Prep work (instructor) 2. Pre-experiment 3. Experiment 4. Post-experiment 5. Evaluation The How’s MATLAB & Simulink Very important Immensely important Typically over-emphasized
  • 6. 6 Hardware connectivity Symbolic Numeric Optimization Control System Graphic, physical Modeling Simscape StateFlow Simulink MATLAB Simulink and Simscape blocks MATLAB function Publishing Symbolic Experiment implementation: the sky’s the limit 1 1 1 1 2 2 2 2
  • 7. 7 The solution landscape: a matter of perspective MATLAB (symbolic) Simulink Simscape MATLAB (numeric) Publishing MATLAB and H/W convert convert convert
  • 8. 8 RLC series circuit: problem statement
  • 9. 9 RLC series circuit: solution and analysis
  • 10. 10 Resources to get you started >> doc MATLAB Courseware MATLAB Central info/code hub
  • 11. 11 Online experimenting: Cody Coursework Problem Solution Feedback  Create MATLAB problem sets  Grade based on test suites (automated!)  Assess class progress  Detect plagiarism and proctor exams  Use 1300+ autograde-ready MATLAB programming problems
  • 12. 12 Hardware for experiments Support package only req’d Additional toolboxes req’d Raspberry Pi LEGO Mindstorms NXT and EV3 Arduino Samsung Galaxy, iPhone Altera DE2- 115 Freescale Freedom Digilent’s Analog Discovery  Find hardware for your application …plus many more…plus many more Microsoft Kinect NI CompactDAQ
  • 13. 13  Retain the right students, on-time: STEOP  Integrate Spiraling Curricula Standardized Tool in Curricula
  • 14. 14 Key takeaways  Experiments can foster the learning progress. Use with care.  Experiments develop competences.  MathWorks provides tools and resources for your support.
  • 15. 15 Challenge Teach mathematics and mathematical modeling to students across multiple disciplines and two universities, and prepare them to meet the needs of industry Solution Integrate MATLAB throughout the core mathematics curriculum and provide interdisciplinary exercises in practical problem-solving Results  Interdepartmental collaboration improved  Students taught skills required by industry  Students self-identified as expert users Chalmers University of Technology Integrates MATLAB Throughout Core Mathematics Curriculum Chalmers University in Gothenburg, Sweden. Link to user story “We train our students to use MATLAB as an interactive tool not only for completing the assigned exercises but also for investigating mathematical problems and having fun. We are increasing our focus on interdisciplinary programs, and MATLAB is perfect for integrating mathematics with other subjects.” Dr. Tommy Gustafsson Chalmers University of Technology
  • 16. 16 University of Applied Sciences Augsburg Students Develop and Simulate Advanced Robotic Control Systems Challenge Enable students to participate in the development of advanced robotic control software Solution Integrate MathWorks tools into exercises in modeling robotic systems and implementing control software Results  Programming skills quickly acquired  Reusable robotic control components developed  Students’ transition to industry eased “When I teach C++, I show students a program that simulates a swing. The C++ program is seven pages of code or more. The MATLAB implementation is a single page —about 50 lines of well-structured, compact code that is easy to understand.” Professor Georg Stark University of Applied Sciences Augsburg Link to user story Professor Stark with students in the lab.
  • 17. 17 Technische Universität München Uses Model-Based Design to Drive Research, Problem-Based Learning, and Industry Collaboration Challenge Enable problem-based learning of flight dynamics and cost-effective implementation of flight control systems Solution Use MathWorks tools for Model-Based Design to simulate designs, conduct real-time tests, and develop realistic flight simulators Results  Students prepared for a variety of careers  Motivation increased and learning accelerated  Collaboration with industry partners strengthened “Flight controls and flight system dynamics are multidomain engineering disciplines. MathWorks tools enable our students to build upon our fundamental research to develop solutions that fly in real aircraft. With Model-Based Design we can close the gap between the theoretical foundation and the practical application, and that is how we measure success.” Dr. Florian Holzapfel Technische Universität München Link to user story Professor Holzapfel, research fellow Markus Hornauer, and a student test flight control algorithms in the Research Flight Simulator.
  • 18. 19
  • 20. 21 Festo Develops Innovative Robotic Arm Using Model-Based Design Challenge Design and implement a control system for a pneumatic robotic arm Solution Use Simulink and Simulink PLC Coder to model, simulate, optimize, and implement the controller on a programmable logic controller Results  Complex PLC implementation automated  Technology and innovation award won  New business opportunities opened “Using Simulink for Model-Based Design enables us to develop the sophisticated pneumatic controls required for the Bionic Handling Assistant and other mechatronic designs. With Simulink PLC Coder, it is now much easier to get from a design to a product.” Dr. Rüdiger Neumann Festo Link to user story The Festo Bionic Handling Assistant. Image © Festo AG.
  • 21. 22 All of the previous applies.
  • 22. 23 But you process more data. Much more data.
  • 23. 24 Max Planck Institute Reconstructs Key Protein Complexes Using MATLAB and Parallel Computing Toolbox Challenge Develop high-quality 3D images of protein complexes Solution Use MathWorks tools to acquire, analyze, filter, combine, and display electron microscope images Results  Research time cut by years  Development time cut from weeks to days  Workflow accelerated “Parallel Computing Toolbox enabled us to speed up our processing by 20 to 30 times. We were able to use our cluster productively from the MATLAB environment without having to be experts in parallel programming or having to learn another programming language.” Andreas Korinek Max Planck Institute of Biochemistry Schematic of the 26S proteasome. Link to user story
  • 24. 26 Challenges with Large Data  “Out of memory”  Slow processing – Data too large to be efficiently managed between RAM and virtual memory – Lots of data  Gaining insight – Large data visualization – Modeling with no equation and lots of predictors
  • 25. 27 Data Copies Function calls  Data is “copy-on-write” (lazy-copy)  Passed by reference into the function function y = foo(x,a,b) y = a * x + b; end function y = foo(x,a,b) a(1) = a(1) + 12; y = a * x + b; end a not copied a is copied Is not modified, no copy is made Is modified, a temporary copy is made
  • 26. 28 Data Copies In-Place Optimizations  MATLAB perform calculations “in-place” when: – Output variable name is the same as input variable name – Performing element-wise computation not in-place y = 2*x + 3; x = 2*x + 3; in-place
  • 27. 29 Sparse Matrices  Require less memory and are faster  When to use sparse? < 1/2 dense on 64-bit (double precision) < 2/3 dense on 32-bit (double precision)  Functions that support sparse matrices >> help sparfun  Blog Post: Creating Sparse Finite Element Matrices blogs.mathworks.com/loren/2007/03/01/creating-sparse-finite-element-matrices-in-matlab/
  • 28. 30 Categorical Arrays Ordinal and Nominal Arrays  Memory-efficient data container for values drawn from a finite, discrete set of categories  Nominal arrays – No ordering in the levels  Ordinal arrays – Ordering in the levels Available from  Statistics Toolbox
  • 29. 31 Vectorization and Memory Tradeoffs  Use bsxfun to limit creating intermediate matrices – Applies element-wise binary operation with singleton expansion  Consider using several smaller matrices for processing – Keep within the limits of contiguous memory – Process with for loops (i.e. de-vectorize) – Slower runtime but will use less memory – Operate on data by column for best performance N x M+,*N x 1 1 x M = Element-wise operation
  • 30. 32 Processing Large Data Sets  Break your large data into separate pieces and process independently – Partial reading and writing of files – Built-in functionality for block-processing – System Objects for stream processing  Use the whole dataset at once – Single array across memory of multiple machines
  • 31. 33 Reading in Part of a Dataset from Files  ASCII file – Import Tool , textscan  MAT file – Load and save part of a variable using the matfile  Binary file – Read and write directly to/from file using memmapfile – Maps address space to file  Databases – ODBC and JDBC-compliant (e.g. Oracle, MySQL, Microsoft, SQL Server) – Database Explorer App
  • 32. 34 Block Processing Images  blockproc automatically divides an image into blocks for processing  Reduces memory usage – Read and write block directly from image file  Processes arbitrarily large images Available from  Image Processing Toolbox
  • 33. 35 Batch processing… Load the entire file and process it all at once Stream processing Load a frame and process it before moving on to the next frame Source Batch Processing Algorithm Memory MATLAB Memory Stream Source Stream Processing
  • 34. 36 System Objects  A class of MATLAB objects that support streaming workflows  Simplifies data access for streaming applications  Contain algorithms to work with streaming data Available from  DSP System Toolbox  Communications System Toolbox  Computer Vision System Toolbox  Phased Array System Toolbox  Image Acquisition Toolbox
  • 35. 37 Distributed Array Lives on the Workers Remotely Manipulate Array from Client 11 26 41 12 27 42 13 28 43 14 29 44 15 30 45 16 31 46 17 32 47 17 33 48 19 34 49 20 35 50 21 36 51 22 37 52 Distributing Large Data Worker Worker Worker Worker MATLAB Desktop (Client) Available from  Parallel Computing Toolbox  MATLAB Distributed Computing Server
  • 36. 39  Offload computation: – Free up desktop – Access better computers  Scale speed-up: – Use more cores – Go from hours to minutes  Scale memory: – Utilize distributed arrays – Solve larger problems without re-coding algorithms Cluster Computer Cluster Scheduler Take Advantage of Cluster Hardware MATLAB Desktop (Client)
  • 37. 40  On bw|HPC-C5  Installed on Grid Nodes KIT, Freiburg, Tübingen  Supported by MathWorks Pilot Team: install, documentation, usage  Also on bwGRiD  Installed on Grid Nodes Ulm/Konstanz, Mannheim, Tübingen
  • 38. 43 Benchmarking Ab on EC2  Using Amazon EC2's cluster compute instances  A up to 290 GB  Good desktop machine  4-20 GB of RAM  20-60 Gigaflops  Up to 1.3 Teraflops, over a 20X improvement
  • 39. 45 Technical Resources  MATLAB documentation User’s Guide Programming Fundamentals  Software Development  Memory Usage  The Art of MATLAB, Loren Shure’s blog: blogs.mathworks.com/loren/  Memory Management Guides mathworks.com/support/tech-notes/1100/1106.html mathworks.com/support/tech-notes/1100/1107.html  MATLAB Answers: mathworks.com/matlabcentral/answers/
  • 40. 46