0% found this document useful (0 votes)
98 views

Introduction To MATLAB

MATLAB is a powerful numerical computing environment and programming language. It contains many built-in functions for tasks like graphing, matrix operations, solving equations, and data analysis. This document provides an introduction and overview of key MATLAB concepts and capabilities, including getting started, help resources, scripting, variable types, basic operations, functions, plotting, and applications in engineering domains like circuits and signals.

Uploaded by

harshithabehara5
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

Introduction To MATLAB

MATLAB is a powerful numerical computing environment and programming language. It contains many built-in functions for tasks like graphing, matrix operations, solving equations, and data analysis. This document provides an introduction and overview of key MATLAB concepts and capabilities, including getting started, help resources, scripting, variable types, basic operations, functions, plotting, and applications in engineering domains like circuits and signals.

Uploaded by

harshithabehara5
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Introduction to

MATLAB
Dr. Rahul Satheesh
Asst. Prof. Amrita School of AI
Amrita Vishwa Vidyapeetham
MATLAB Basics
• Super powerful graphing calculator
• With many more buttons(built-in functions)
• MATLAB is an interpreted language like python
• Commands are executed line by line
Getting started
• To get MATLAB Student Version for yourself
• You can also use MATLAB online
• https://matlab.mathworks.com (requires Mathworks account with license)
Help/Docs
• help: the most important command for learning MATLAB on your own|
To get info on how to use a function
• help sin
Help lists related functions at the bottom and links to the documentation
• doc sin ( To get a nicer version of help with examples and easy to read
description)
• docsearch sin trigonometric (to search for a function by specifying keywords)
Scripts
• Collection of commands executed in sequence
• Written in the MATLAB editor
• Saved a m-files
• To create an mfile from the command line
 edit MyFileName.m or click the “ New Script” button on the top left
Scripts
• Comment
Anything following a % sign is interpreted as a comment
Comment thoroughly to avaoid wasting time later
Mark beginning of a code block by using %%
Variable types
• MATLAB is a weakly typed language: no need to initialize variables
• MATLAB supports various types: the most popular ones are
• 3.84 (64 bit double)
• A (16 bit char)
• Most variables you ‘ll deal with are vectors, matrice, doubles or chars
• Other types are also supported : complex, symbolic, 16 bit and 8 bit integers
scalars
Arrays
Size and length
Matrices
Save/clear/ load
• Use save to save varaiables to a file
• Save myFile a b
• Use clear to save variable sto a file
• clear a b
• Use load to load variables in to the workspace
• load myFile
Basic scalar Operations
Built in functions
Transpose
Addition and substraction
Element wise functions
Operators
Automatic initialization
Vector indexing
• MATLAB indexing starts with 1 not 0
Matrix Indexing
Basic Plotting
User defined functions
Relational operators
If/else/elseif
for
While
Plot Options
Cartesian plots
3D line plots
Multiple plots in one figure
Visualizing matrices
Surface Plots
Few plotting functions
Performance matrices
Systems of linear equations
Matrix decompositions
Optimization Toolbox
Numerical differentiation
Numerical integration
Voltage division rule
Current division rule
Mesh Analysis & Node analysis
• Mesh Analysis
Thevenin’s theorem
Nortons Theorem
Determine the current flowing in 10ohm resistor
Superposition theorem
Superposition Theorem
Find the current flowing through 20 Ω
using the superposition theorem.
Solution of first order differential equation
• Study of transients in an RC series circuit
• Q1. Find the current flowing through the RC circuit shown in fig and
the voltage across the capacitor when the switch closed at time t=0.
The circuit parameters are as follows:
R=100Ω, C= 1000μF , V=100V
1. Assume initial conditions to be zero
2. With initial voltage Vco=-50V

You might also like