This post explains how to use subplot in MATLAB with examples. Subplot command is used to create multiple plots in a grid layout. Syntax To divide the figure into an m x n grid and create an axes / new plot at position p, we can write The first subplot (p = 1) is the…
Category: How To
How to Simulate STM32 Project in Proteus
This posts describes how to simulate an STM32 project in Proteus using STM32Cube IDE and Hardware Abstraction Layer (HAL). We will write a code to blink an LED in STMCube IDE and then test it in Proteus. STM32 is a family of 32-bit microcontrollers developed by STMicroelectronics. STM32 is based on the ArmĀ® Cortex-M architecture….
Writing Vectorized MATLAB Code
Introduction This tutorial demonstrates benefits of writing vectorized MATLAB code which runs orders of magnitude faster than non-vectorized code. A loop is usually used if you want to perform same calculations on selected elements of an array. Vectorization is much faster alternative which can do the same in a single statement (or at least much…
How to simulate a PIC18 assembly project in Proteus
Introduction This tutorial will explain step by step how to create an assembly project in MPLAB X for PIC18 micro-controller and simulate it using Proteus. For this tutorial I am using MPLAB X v5.0 but you can use any version upto v5.35. Version 5.35 is last version that included MPASM i.e. the assembler we require…
How to Index a 2D Matrix in MATLAB
Introduction In this tutorial we learn how to index a 2D Matrix or array in MATLAB. Properly indexing arrays is necessary to use MATLAB effectively. This tutorial will teach you various ways to properly access modify or use values stored in a 2D array. Before discussing indexing, it is important to review how data is…
How to Index a Vector in MATLAB
Introduction In this tutorial we learn how to index a vector in MATLAB. Properly indexing vectors is necessary when working with them in MATLAB. If you want to use MATLAB effectively then understanding this topic can help you a lot in learning to properly access modify or use values stored in a vector. Defining a…
How to create a MATLAB Function
Introduction to Functions The goal of this tutorial is to explain how to create a MATLAB function. Function is a set of statements that performs a specific task. MATLAB has thousands of builtin functions like sin(), log(), randn(). MATLAB also allows the programmer to create their own functions. Creating function allows reuse of a set…