Introduction to MATLAB

PSYC480

Usman Afzali

University of Canterbury

2024-05-01

Outline

What’s on today?

  • Introducing the PSYC480 Blog
  • What is MATLAB?
  • User interface
  • Getting started
  • Basic operations
  • Working with imported data
  • What’s next?

Resources

PSYC480 Blog

MATLAB

Introduction

MATLAB, short for “MATrix LABoratory,” is a high-level programming language and interactive environment primarily designed for numerical computation, data analysis, and visualization. It provides a comprehensive set of tools and functions for various domains, including mathematics, engineering, and science. MATLAB allows users to perform matrix manipulations, implement algorithms, create graphical user interfaces (GUIs), and interface with other programming languages and software packages. It is widely used in academia, industry, and research for tasks such as signal processing, image processing, control systems design, and machine learning. (from ChatGPT)

From the horse’s mouth

What is MATLAB

Uses (from ChatGPT)

  1. Numerical computation
  2. Data analysis and visualization
  3. Signal processing
  4. Image processing and computer vision
  5. Control systems design and analysis
  1. Machine learning and deep learning
  2. Optimization and mathematical modeling
  3. Simulation of dynamic systems
  4. Financial modeling and analysis
  5. Computational biology and bioinformatics

Uses continued (from ChatGPT)

  1. Computational fluid dynamics (CFD)
  2. Geospatial analysis and mapping
  3. Time-series analysis and forecasting
  4. Statistical analysis and hypothesis testing
  5. Graph theory and network analysis
  1. Robotics and autonomous systems
  2. Audio processing and speech recognition
  3. Cryptography and security analysis
  4. Education and teaching (simulations, course materials)
  5. Application development (applications, GUIs)

User Interface

MATLAB user interface

Getting started

MATLAB user interface

Getting started

  • Setting path
  • Examples:
  • Setting up EEGLab followed by Microstates
  • Removing paths

Basic operations

Arithmetic

a = 1
b = 2
c = a + b
d = sqrt (b)
e = a * b
  • Use up- and down-arrow keys to recall previous commands.
  • Use % for comments.

Using a MATLAB script

  • File: basics.m on Learn.
  • Some basics commands:
  • to get help, use help function name
  • or use doc function name

Working with imported data

Toolboxes and Apps

MATLAB toolboxes

  1. MATLAB Toolboxes are collections of functions, algorithms, and graphical user interfaces (GUIs) that extend the core functionality of MATLAB for specific applications or industries.

  2. Toolboxes provide specialized tools and algorithms for tasks such as signal processing, image processing, control systems design, optimization, and more.

MATLAB toolboxes ….

  1. Users can purchase or access various Toolboxes to enhance MATLAB’s capabilities in specific domains. Toolboxes can be seamlessly integrated into MATLAB, allowing users to access their functions and tools within the MATLAB environment.

Examples: Signal Processing Toolbox, Image Processing Toolbox, Control System Toolbox, Optimization Toolbox, Statistics and Machine Learning Toolbox.

MATLAB apps

  1. MATLAB Apps are interactive applications built using MATLAB’s App Designer tool, which allows users to create custom graphical user interfaces (GUIs) for their MATLAB code.
  2. Apps provide a user-friendly interface for performing specific tasks or workflows, enabling users to interact with MATLAB functionality without needing to write code.

MATLAB apps ….

  1. Users can design Apps to automate complex processes, visualize data, or streamline repetitive tasks, making MATLAB more accessible to users with varying levels of programming experience.

  2. MATLAB Apps can be shared and distributed to other users, allowing for collaboration and deployment of custom tools and workflows.

Examples: Image Viewer App, Signal Analyzer App, Control System Tuner App, Curve Fitting App, Machine Learning App.

What’s next?

How to learn programming?

The END