Matlab basics ppt

matlab lecture notes ppt and matlab tutorial ppt presentation and matlab introduction presentation
DannyConnolly Profile Pic
Published Date:14-07-2017
Your Website URL(Optional)
MATLAB and C/C++ The perfect combination for signal processing © 2013 The MathWorks, Inc. 1 Signal Processing Algorithm Design with C/C++ and MATLAB Algorithm Algorithm Testing & Deployment Specification Development Development Debugging C/C++ C/C++ MATLAB Specialized Libraries Algorithm Test & Implementation Development Verification & Deployment 4 In This Presentation  Combining MATLAB and C/C++ for – Test and verification – Algorithm development, research, design – Implementation and deployment  Examples from – Wireless communications – Image processing and computer vision – Audio and digital signal processing 5 MATLAB and C/C++ Use Case 1: Call MATLAB from C/C++ C/C++  MATLAB Engine Interface – Interactive Algorithm Development – Debugging of C or MATLAB Code – Plotting / Visualization – Connect to Data Acquisition, Test and Measurement Systems 6 Bluetooth Example  Find Engineering Defects in C with MATLAB  Plot and Visualize Data in MATLAB Example 7 Bluetooth Example Test and Debug Your C Project and Visualize Data/Results  Add header file and libraries to your project  Package data into MATLAB data structure (mxArray)  Use engine routines to: – Send data to MATLAB – Perform computations in MATLAB – Plot data in MATLAB  For C++ example, see: – 8 MATLAB and C/C++ Use Case 2: Generate C code from MATLAB  MATLAB Coder – Generate C from MATLAB C/C++ – Integrate with your C/C++ source – Build and deploy complete applications  No royalty or deployment restrictions on code generated with MATLAB Coder MATLAB C Coder 12 Simple C Code Generation Example MATLAB: a=bc; C: ? Example 13 Implementation Considerations  MATLAB  C – Polymorphic datatypes – Explicit datatype declaration & handling – Automatic memory management – Define and manage: Data size, memory, matrices, arrays,… – Built-in matrix & array support Kalman Filter Example MATLAB Code: 7 lines C Code: 107 lines 14 Lane Markings Example  Generate C from MATLAB and integrate with C/C++ Example 15 Lane Markings Example Generate C from MATLAB  Prepare your MATLAB algorithm – Make implementation choices – Use supported language features  Test if your MATLAB code is compliant – Validate that MATLAB program generates code – Accelerate execution of user-written algorithm  Generate source code or MEX – Iterate your MATLAB code to optimize – Implement as source, executable or library 16 MATLAB Language Support for Code Generation  Broad set of language features and functions/system objects supported for code generation Programming Matrices and Arrays Data Types Functions Constructs • Matrix operations • Complex numbers • Arithmetic, relational, and • MATLAB functions and sub-functions • N-dimensional arrays • Integer math logical operators • Variable length argument lists • Subscripting • Double/single-precision • Program control • Function handles • Frames • Fixed-point arithmetic (if, for, while, switch ) • Persistent variables • Characters Supported algorithms • Global variables • Structures • 400 MATLAB operators and functions • Numeric classes • 200 System objects for • Variable-sized data • System objects • Signal processing • Communications • Computer vision 17 MATLAB and C/C++ Use Case 3: Reuse MATLAB IP in Your C/C++ Code  Create specialized algorithm libraries in MATLAB C/C++ – Generate C with MATLAB Coder – Or, automatically create shared libraries with MATLAB Compiler or MATLAB Coder dll MATLAB  DLL, LIB Compiler exe – Access MATLAB algorithms from C/C++ with DLLs or LIBs lib MATLAB dll C Coder exe  No royalty or deployment restrictions 18 Deploying Applications with MATLAB Toolboxes MATLAB End-User 1 Desktop Machine MATLAB Compiler 2 3 ..dll dll 19 Deploying Applications with MATLAB  Give MATLAB code to other users MATLAB Compiler MATLAB MATLAB MATLAB Builder EX Builder JA Builder NE  Share applications with end users who do not need MATLAB .dll .exe Excel Java .NET – Stand-alone executables Web .lib – Shared libraries – Software components 20 MATLAB Compiler and MATLAB Coder MATLAB Coder MATLAB Compiler .dll .exe .exe .lib .dll 21 MATLAB Compiler and MATLAB Coder MATLAB Coder MATLAB Compiler Executable or software Portable and readable Output component/library C source code Full Subset MATLAB language support MATLAB Compiler Runtime (MCR) None Additional libraries Most toolboxes Some toolboxes Supported toolboxes Royalty-free Royalty-free License model Builder Products Embedded Coder Extensions 22 MATLAB and C/C++ Use Case 4: Reuse your C/C++ libraries in MATLAB  loadlibrary – Load your library functions C/C++ – Access your IP as custom libraries in MATLAB – Combine with standard MATLAB functions, scripts, System objects lib 23 MATLAB and C/C++: Summary of Use Cases  Call MATLAB from C C/C++  Generate C from MATLAB  Use C Libraries in dll MATLAB MATLAB mex Compiler exe  Use C Code in MATLAB  Generate IP libraries or lib MATLAB deploy applications from dll lib C Coder exe MATLAB 25 You can enhance your C and C++ development process using the data analysis, visualization, algorithm development, code generation, deployment, test and verification capabilities of MATLAB MATLAB and C/C++: The Perfect Combination for Signal Processing 26