


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The key points in these lecture slides of intro to computer programming are given as:Introduction to Matlab, Numerical Computation, Built-In Functions, Data Analysis, Signal Processing, Matrix Laboratory, Matlab Variable Names, Matlab Special Variables, Assignment Operators, Matlab Math
Typology: Slides
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























To get started, type one of these commands: helpwin, helpdesk, or demo
EDU» a=5;
EDU» b=a/
b =
EDU»
Power ^ or .^ a^b or a.^b
Multiplication * or .* ab or a.b
Division / or ./ a/b or a./b
or \ or .\ b\a or b.\a NOTE: 56/8 = 8\
Addition + a + b
Subtraction - a - b
Assignment = a = b (assign b to a)
prompt
... continue statement on next line , separate statements and data % start comment which ends at end of line ; (1) suppress output (2) used as a row separator in a matrix
: specify range
EDU» a_value=
a_value =
EDU» rowvec = [12 , 14 , 63]
rowvec =
EDU» matrix = [1 , 2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9]
matrix =
sub_matrix = matrix ( r1 : r2 , c1 : c2 ) ;
where r1 and r2 specify the beginning and ending rows and c1 and c specify the beginning and ending columns to be extracted to make the new matrix.
EDU» matrix=[1,2,3;4,5,6;7,8,9]
matrix =
1 2 3 4 5 6 7 8 9
EDU» rowvec=matrix(2 : 2 , 1 : 3)
rowvec =
4 5 6
load mydata.dat; % load s file into matrix.
% The matrix may be a scalar, a vector, or a
% matrix with multiple rows and columns. The
% matrix will be named mydata.
size (mydata) % size will return the number
% of rows and number of % columns in the matrix
length (myvector) % length will return the total
% no. of elements in myvector
% To put a label on the axes we would use: xlabel ('X-axis label') ylabel ('Y-axis label')
% To put a title on the plot, we would use: title ('Title of my plot')
first_vector = mydata ( : , 1) ; % First column
second_vector = mydata ( : , 2) ; % Second one
% and we can plot the data
plot ( first_vector , second_vector )