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

Introduction To Matlab: Basic Mathematical Operations

This document provides an introduction to basic operations in MATLAB including creating vectors and matrices, performing mathematical operations on vectors and matrices, and generating different types of graphs. Key points covered are: 1) Creating a simple 9 element vector and adding 2 to each element to demonstrate vector math. 2) Plotting the result of the vector addition with grid lines to create a simple graph. 3) Generating a bar graph with labeled axes to show another graph type. 4) Using different symbols like stars to mark data points in plots.

Uploaded by

Ranjith Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Introduction To Matlab: Basic Mathematical Operations

This document provides an introduction to basic operations in MATLAB including creating vectors and matrices, performing mathematical operations on vectors and matrices, and generating different types of graphs. Key points covered are: 1) Creating a simple 9 element vector and adding 2 to each element to demonstrate vector math. 2) Plotting the result of the vector addition with grid lines to create a simple graph. 3) Generating a bar graph with labeled axes to show another graph type. 4) Using different symbols like stars to mark data points in plots.

Uploaded by

Ranjith Reddy
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

INTRODUCTION TO MATLAB

BASIC MATHEMATICAL OPERATIONS

Basic Matrix Operations


This is a demonstration of some aspects of the MATLAB language. First, let's create a simple vector with 9 elements called a. a = [1 2 3 4 6 4 3 4 5] a=123464345 Now let's add 2 to each element of our vector, a, and store the result in a new vector. Notice how MATLAB requires no special handling of vector or matrix math. b=a+2

Creating graphs in MATLAB


Creating graphs in MATLAB is as easy as one command. Let's plot the result of our vector addition with grid lines. plot(b) ; grid on ;

BAR GRAPH
MATLAB can make other graph types as well, with axis labels. bar(b) xlabel('Sample #') ylabel('Pounds')

TO GET DESIRED SYMBOLS IN GRAPHS


MATLAB can use symbols in plots as well. Here is an example using stars to mark the points. MATLAB offers a variety of other symbols and line types. plot(b,'*') axis([0 10 0 10])

Creating a matrix is as easy as making a vector, using semicolons (;) to separate the rows of a matrix. A = [1 2 0; 2 5 -1; 4 10 -1] A=1 2 0 2 5 -1 4 10 -1 We can easily find the transpose of the matrix A. B = A'

B= 1 2 4 2 5 10 0 -1 -1 Now let's multiply these two matrices together. C=A*B ANS: C = 5 12 24 12 30 59 24 59 117

You might also like