SlideShare a Scribd company logo
MATLAB
Programming
By : Ahmed Moawad
LET’S BEGIN……
MATLAB is a tool that simplify the programming than
any other programming language like c , c# , …….
Let’s begin with first function in MATLAB …
And the most helpful Fn .
>> help ;
this function gives you a very useful tutorial ,
and information about using MATLAB in every
applications.
1
FIRST TIME : HOW TO INPUT A MATRIX OR
VECTOR IN MATLAB


Vector :
>> x = [1 2 3 4]
x=1
2
3

4

o Matrix :
>> y = [1 2 3 ; 5 1 4 ; 2 3 1]
y=1
2
3
5
1
4
2
3
1
2
CHARACTERISTICS OF MATRIX
Transpose :
>> xt = x ’
convert the columns to rows and vice versa
x=1
2
3
4
 >> x = [1 : 5]
x=1 2 3 4 5
this is the step of increment
 >>x = [1 : 2 : 5]
x=1 3 5


3
CONTINUE……
>>size (y)
Number of columns and rows
 >>length(y)
The tallest dimension(row , column) of Matrix
1
 >>z = y( 2 , 2:3 )
Choose the second & third columns.
5
z=1 4
Choose the second row.
 >>zeros(M ,N);
Matrix consists of zeros
 >>ones(M,N);
Matrix consists of ones
 >>eye(M,N) ;
The main diameter of Matrix is ones , others zeros
 >>rand (M,N) ;
Uniform Distribution
 >>randn (M,N);
Normally Disribution


4
OPERATORS
Scalar Arithmetic Operations :
>> z = x * y; multiply every element in x to its corresponding in y.


Matrices Arithmetic Operations:
>> z = x .* y ; multiply as matrices rules ,with condition (Num. of rows


of x = Num. of columns of y)
+

.+

Summation

-

.-

Subtraction

/

./

Division

^

.^

Exponential
5
FUNCTIONS BREAK (1):


>>sign(x) ;

If an element in matrix x is +ve returns 1 ,-ve returns

-1.

>>exp (2) The exponential function.
ans = 7.3891
 round (x); Approximate the number x to the nearest number
 Fix (x) ;
Delete the fraction (1.2>>1, 1.6 >>1)
 Abs(complex ); Magnitude of complex number
 Angle(comp.); Angle of complex number
 Real(complex); Real part of complex.
 isprime(x) ; 0 for not , 1 for prime number


6
FLOW CONTROL FUNCTIONS
For loop:
i.e.:
>>a=3;
initial value of b
>>for i = 1 :1: 10;
initial : step : final
a=a +i;
end
>> disp(a);
Fn. that display the value of a
>>sprintf (‘the number of icons is = %g ’ , a)


print the sentence ‘ ’ , replaces the %g by a
7
.

CONTINUE …

While loop:
i.e.:
>>b =0;
initial value of b
>>while b<4
carry out if b <4 , stop if else
b=b+1;
end
>>weight = b*2.2;
>>disp(b);
>>sprintf(‘The weight equals %f ’ , weight)


weight is float type
8
..

CONTINUE …
If Statement:
i.e.:


degree =input(‘please insert the degree(0-100): ’)
fn. that make user input the value which preferred

if degree>= 85
disp(‘Excellent’)
elseif( degree>= 75 & degree <85)
disp(‘very good’)
elseif( degree>= 65 & degree <75)
disp(‘good’)
elseif( degree>= 50 & degree <65)
disp(‘pass’)
else
disp(‘fail’)
end

9
…

CONTINUE …

Switch …case:
i.e.:
month= input (‘please input the month(1-12): ’)
switch month
case { 1,3,5,7,8,10,12} more than one case>> {1,2,…..}
disp (31)
case{4 , 6 ,9 ,11}
disp (30)
case 2
only one case>> 1
disp (28)
end


10
FUNCTION BREAK(2):
>>Str = ‘ the sentence you want to write’
 >>w = str [ 1 2 5 7 9]
w = thsne
 x(2) = 4
change the second element value in the matrix x to 4.
 X(3) = [ ]
delete the third element .
 mean(x)
The mean of elements of x .
 std(x)
The standard diversion of elements of x.
 [theta phi r ] = cart2sph [2 , 3 , 5]


any names indicates the sph.

Conversion fn.

the values of Cartesian coordinates

11
GRAPHS
Line plot :
i.e.:
>>t = [ 0 : 10 ];
>> y = sin(t);
>>Figure(1)
>>plot (t,y)
>>xlabel(‘time’)
>>ylabel(‘input’)
>>title (‘Gain’)


y is sinusoidal wave on t
Open figure , name it 1

plot t(h-axis) versus y (v-axis) in figure.
write 9time) under h-axis
write (input) beside v-axis
Make a title for plot
12
.

CONTINUE …

Bar Graph:
i.e.:
>>x = -3 : 1 : 3;
>>y = x.^2;
>>bar(x,y)
Bar Graph
>>figure(1)
>>subplot 221
divide the figure into number of plots
>>z= magic (3);
special function
>>subplot 222
row no. column no. position
>>bar(z)
>>subplot (2,2,3)
>> bar(z , ‘grouped’) Style type
>>subplot(2,2,4)
>>bar (z , ‘stacked’)


13
..

CONTINUE …
Histogram :
>> hist (z , 7 )


Number of intervals in histogram

Pie Graph :
>>z = [10 4 5 8 2];
>>pie(z)


Polar Graph :
>>polar(t , y)


14
…

CONTINUE …

Scatter plot :
>>x =[1:10];
>> y = 2.*rand (1,10)
>>subplot 221
>>scatter(x ,y)
scatter points on plot
>>subplot 222
>> stem ( x , y)
scatter points connected with the h-axis
>>subplot 223
>>scatter(x ,y , 3 , ‘y’ ) Mark color (yellow)


size of mark (scatter point)
15
….

CONTINUE …

Pie graph

scatter graph

Polar graph

Bar graph

Histogram

16
FUNCTION BREAK(3)
>>log (x)
 >>log10(x)
 >>log2 (x)
 >>semilogy(x,y)
 >>semilogx(x,y)
 >>loglog(x,y)
 >>barh(z)
 >>break;
 >>continue;
 >>surf(x,y,z)
 >>contour(x,y,z)


Ln Function
Log. Decimal Function
Log. Binary Function
convert v-axis to dB
convert h-axis to dB
convert two axes to dB
Opposite of Bar graph
stop loop and move to the next command
stop the itertion and move to the other itertion on loop

Graph the surface and put the points on it
17
SYMBOLIC MATH :


Functions:



>>syms x y z ;
convert this variables into symbols
>>f = x^2 + y^2 +z^2;
Substitution
the symbols you want substitute
>>f1 = subs( f , [x y] , [4 5] )
the values of substitution
f1 = 16 + 25+z^2
Differentiation
>>f2 = diff ( f , 2 , z )
The symbol you want to diff.
f2 = 2
The order of diff.
Integration
>>f3 = int (f1 , -10 , 10 )
Final limit
f3 = 5
initial limit
Limit Fn
>>limit ( sin (x) /x , inf )
the value the limit approximate to
Summation
>>symsum( 1 / x^2 , 1 , inf )
the final sub . of summation
the initial sub. of summation
















18
DOMAINS TRANSFORMS :
Laplace Transform :
>>syms t ;
>> laplace ( cos (t))
laplace transform
Ans = s / (s^2 +1)
>>ilaplace (s/ (s^2 +1)
inverse laplace transform
Ans = cos t
>>transferfn = tf ([1] , [1 2 1]) transfer fn.
Transfer function = 1 / s^2 + 2* s + 1
>> bode(transferfn)
Bode plot
>> step(transferfn)
Step response
>> impulse (transferfn)
Impulse response


19
.

CONTINUE …

Fourier Transform :
>>syms t w b ;
>>y = cos(b*t);
>> f = fourier (x , t ,w );
>>y = cos( 2*pi *t);
>>fd = fft ( y , 512 );
must be 2^n


20
THANK YOU

More Related Content

What's hot

Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
Satish Gummadi
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4
Randa Elanwar
 
matlab
matlabmatlab
matlab
Farhan Ahmed
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
krajeshk1980
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4
Randa Elanwar
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
Naveed Rehman
 
2D Plot Matlab
2D Plot Matlab2D Plot Matlab
2D Plot Matlab
Jorge Jasso
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Dnyanesh Patil
 
MATLAB Scripts - Examples
MATLAB Scripts - ExamplesMATLAB Scripts - Examples
MATLAB Scripts - Examples
Shameer Ahmed Koya
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
Cheng-An Yang
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
Infinity Tech Solutions
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
ZunAib Ali
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
Ray Phan
 
MATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaMATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi Sharma
Abee Sharma
 

What's hot (20)

Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
What is matlab
What is matlabWhat is matlab
What is matlab
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Matlab1
Matlab1Matlab1
Matlab1
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4
 
matlab
matlabmatlab
matlab
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
2D Plot Matlab
2D Plot Matlab2D Plot Matlab
2D Plot Matlab
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
MATLAB Scripts - Examples
MATLAB Scripts - ExamplesMATLAB Scripts - Examples
MATLAB Scripts - Examples
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
MATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaMATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi Sharma
 

Similar to Intro to Matlab programming

mat lab introduction and basics to learn
mat lab introduction and basics to learnmat lab introduction and basics to learn
mat lab introduction and basics to learn
pavan373
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
kebeAman
 
Application of derivative
Application of derivativeApplication of derivative
Rational Functions
Rational FunctionsRational Functions
Rational Functions
Jazz0614
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
gilpinleeanna
 
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docxMAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
jessiehampson
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
Ch 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticsCh 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticssrobbins4
 
Lesson 2: A Catalog of Essential Functions
Lesson 2: A Catalog of Essential FunctionsLesson 2: A Catalog of Essential Functions
Lesson 2: A Catalog of Essential Functions
Matthew Leingang
 
Function
FunctionFunction
Function
KAZEMBETVOnline
 
Matlab differential
Matlab differentialMatlab differential
Matlab differential
pramodkumar1804
 
17, r) -,r I -l19.t... 121.2t-314 23. ^t -rr - .docx
17, r) -,r I  -l19.t... 121.2t-314 23. ^t -rr - .docx17, r) -,r I  -l19.t... 121.2t-314 23. ^t -rr - .docx
17, r) -,r I -l19.t... 121.2t-314 23. ^t -rr - .docx
hyacinthshackley2629
 
Matlab
MatlabMatlab
matlab_tutorial.ppt
matlab_tutorial.pptmatlab_tutorial.ppt
matlab_tutorial.ppt
naveen_setty
 
matlab_tutorial.ppt
matlab_tutorial.pptmatlab_tutorial.ppt
matlab_tutorial.ppt
aboma2hawi
 
Graph a function
Graph a functionGraph a function
Graph a function
SanaullahMemon10
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programmingDamian T. Gordon
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
agnesdcarey33086
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
Mel Anthony Pepito
 

Similar to Intro to Matlab programming (20)

mat lab introduction and basics to learn
mat lab introduction and basics to learnmat lab introduction and basics to learn
mat lab introduction and basics to learn
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 
Application of derivative
Application of derivativeApplication of derivative
Application of derivative
 
Rational Functions
Rational FunctionsRational Functions
Rational Functions
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
 
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docxMAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
MAT-121 COLLEGE ALGEBRAWritten Assignment 32 points eac.docx
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
Ch 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticsCh 7 tutoring notes quadratics
Ch 7 tutoring notes quadratics
 
bobok
bobokbobok
bobok
 
Lesson 2: A Catalog of Essential Functions
Lesson 2: A Catalog of Essential FunctionsLesson 2: A Catalog of Essential Functions
Lesson 2: A Catalog of Essential Functions
 
Function
FunctionFunction
Function
 
Matlab differential
Matlab differentialMatlab differential
Matlab differential
 
17, r) -,r I -l19.t... 121.2t-314 23. ^t -rr - .docx
17, r) -,r I  -l19.t... 121.2t-314 23. ^t -rr - .docx17, r) -,r I  -l19.t... 121.2t-314 23. ^t -rr - .docx
17, r) -,r I -l19.t... 121.2t-314 23. ^t -rr - .docx
 
Matlab
MatlabMatlab
Matlab
 
matlab_tutorial.ppt
matlab_tutorial.pptmatlab_tutorial.ppt
matlab_tutorial.ppt
 
matlab_tutorial.ppt
matlab_tutorial.pptmatlab_tutorial.ppt
matlab_tutorial.ppt
 
Graph a function
Graph a functionGraph a function
Graph a function
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
 

Recently uploaded

Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 

Intro to Matlab programming

  • 2. LET’S BEGIN…… MATLAB is a tool that simplify the programming than any other programming language like c , c# , ……. Let’s begin with first function in MATLAB … And the most helpful Fn . >> help ; this function gives you a very useful tutorial , and information about using MATLAB in every applications. 1
  • 3. FIRST TIME : HOW TO INPUT A MATRIX OR VECTOR IN MATLAB  Vector : >> x = [1 2 3 4] x=1 2 3 4 o Matrix : >> y = [1 2 3 ; 5 1 4 ; 2 3 1] y=1 2 3 5 1 4 2 3 1 2
  • 4. CHARACTERISTICS OF MATRIX Transpose : >> xt = x ’ convert the columns to rows and vice versa x=1 2 3 4  >> x = [1 : 5] x=1 2 3 4 5 this is the step of increment  >>x = [1 : 2 : 5] x=1 3 5  3
  • 5. CONTINUE…… >>size (y) Number of columns and rows  >>length(y) The tallest dimension(row , column) of Matrix 1  >>z = y( 2 , 2:3 ) Choose the second & third columns. 5 z=1 4 Choose the second row.  >>zeros(M ,N); Matrix consists of zeros  >>ones(M,N); Matrix consists of ones  >>eye(M,N) ; The main diameter of Matrix is ones , others zeros  >>rand (M,N) ; Uniform Distribution  >>randn (M,N); Normally Disribution  4
  • 6. OPERATORS Scalar Arithmetic Operations : >> z = x * y; multiply every element in x to its corresponding in y.  Matrices Arithmetic Operations: >> z = x .* y ; multiply as matrices rules ,with condition (Num. of rows  of x = Num. of columns of y) + .+ Summation - .- Subtraction / ./ Division ^ .^ Exponential 5
  • 7. FUNCTIONS BREAK (1):  >>sign(x) ; If an element in matrix x is +ve returns 1 ,-ve returns -1. >>exp (2) The exponential function. ans = 7.3891  round (x); Approximate the number x to the nearest number  Fix (x) ; Delete the fraction (1.2>>1, 1.6 >>1)  Abs(complex ); Magnitude of complex number  Angle(comp.); Angle of complex number  Real(complex); Real part of complex.  isprime(x) ; 0 for not , 1 for prime number  6
  • 8. FLOW CONTROL FUNCTIONS For loop: i.e.: >>a=3; initial value of b >>for i = 1 :1: 10; initial : step : final a=a +i; end >> disp(a); Fn. that display the value of a >>sprintf (‘the number of icons is = %g ’ , a)  print the sentence ‘ ’ , replaces the %g by a 7
  • 9. . CONTINUE … While loop: i.e.: >>b =0; initial value of b >>while b<4 carry out if b <4 , stop if else b=b+1; end >>weight = b*2.2; >>disp(b); >>sprintf(‘The weight equals %f ’ , weight)  weight is float type 8
  • 10. .. CONTINUE … If Statement: i.e.:  degree =input(‘please insert the degree(0-100): ’) fn. that make user input the value which preferred if degree>= 85 disp(‘Excellent’) elseif( degree>= 75 & degree <85) disp(‘very good’) elseif( degree>= 65 & degree <75) disp(‘good’) elseif( degree>= 50 & degree <65) disp(‘pass’) else disp(‘fail’) end 9
  • 11. … CONTINUE … Switch …case: i.e.: month= input (‘please input the month(1-12): ’) switch month case { 1,3,5,7,8,10,12} more than one case>> {1,2,…..} disp (31) case{4 , 6 ,9 ,11} disp (30) case 2 only one case>> 1 disp (28) end  10
  • 12. FUNCTION BREAK(2): >>Str = ‘ the sentence you want to write’  >>w = str [ 1 2 5 7 9] w = thsne  x(2) = 4 change the second element value in the matrix x to 4.  X(3) = [ ] delete the third element .  mean(x) The mean of elements of x .  std(x) The standard diversion of elements of x.  [theta phi r ] = cart2sph [2 , 3 , 5]  any names indicates the sph. Conversion fn. the values of Cartesian coordinates 11
  • 13. GRAPHS Line plot : i.e.: >>t = [ 0 : 10 ]; >> y = sin(t); >>Figure(1) >>plot (t,y) >>xlabel(‘time’) >>ylabel(‘input’) >>title (‘Gain’)  y is sinusoidal wave on t Open figure , name it 1 plot t(h-axis) versus y (v-axis) in figure. write 9time) under h-axis write (input) beside v-axis Make a title for plot 12
  • 14. . CONTINUE … Bar Graph: i.e.: >>x = -3 : 1 : 3; >>y = x.^2; >>bar(x,y) Bar Graph >>figure(1) >>subplot 221 divide the figure into number of plots >>z= magic (3); special function >>subplot 222 row no. column no. position >>bar(z) >>subplot (2,2,3) >> bar(z , ‘grouped’) Style type >>subplot(2,2,4) >>bar (z , ‘stacked’)  13
  • 15. .. CONTINUE … Histogram : >> hist (z , 7 )  Number of intervals in histogram Pie Graph : >>z = [10 4 5 8 2]; >>pie(z)  Polar Graph : >>polar(t , y)  14
  • 16. … CONTINUE … Scatter plot : >>x =[1:10]; >> y = 2.*rand (1,10) >>subplot 221 >>scatter(x ,y) scatter points on plot >>subplot 222 >> stem ( x , y) scatter points connected with the h-axis >>subplot 223 >>scatter(x ,y , 3 , ‘y’ ) Mark color (yellow)  size of mark (scatter point) 15
  • 17. …. CONTINUE … Pie graph scatter graph Polar graph Bar graph Histogram 16
  • 18. FUNCTION BREAK(3) >>log (x)  >>log10(x)  >>log2 (x)  >>semilogy(x,y)  >>semilogx(x,y)  >>loglog(x,y)  >>barh(z)  >>break;  >>continue;  >>surf(x,y,z)  >>contour(x,y,z)  Ln Function Log. Decimal Function Log. Binary Function convert v-axis to dB convert h-axis to dB convert two axes to dB Opposite of Bar graph stop loop and move to the next command stop the itertion and move to the other itertion on loop Graph the surface and put the points on it 17
  • 19. SYMBOLIC MATH :  Functions:  >>syms x y z ; convert this variables into symbols >>f = x^2 + y^2 +z^2; Substitution the symbols you want substitute >>f1 = subs( f , [x y] , [4 5] ) the values of substitution f1 = 16 + 25+z^2 Differentiation >>f2 = diff ( f , 2 , z ) The symbol you want to diff. f2 = 2 The order of diff. Integration >>f3 = int (f1 , -10 , 10 ) Final limit f3 = 5 initial limit Limit Fn >>limit ( sin (x) /x , inf ) the value the limit approximate to Summation >>symsum( 1 / x^2 , 1 , inf ) the final sub . of summation the initial sub. of summation               18
  • 20. DOMAINS TRANSFORMS : Laplace Transform : >>syms t ; >> laplace ( cos (t)) laplace transform Ans = s / (s^2 +1) >>ilaplace (s/ (s^2 +1) inverse laplace transform Ans = cos t >>transferfn = tf ([1] , [1 2 1]) transfer fn. Transfer function = 1 / s^2 + 2* s + 1 >> bode(transferfn) Bode plot >> step(transferfn) Step response >> impulse (transferfn) Impulse response  19
  • 21. . CONTINUE … Fourier Transform : >>syms t w b ; >>y = cos(b*t); >> f = fourier (x , t ,w ); >>y = cos( 2*pi *t); >>fd = fft ( y , 512 ); must be 2^n  20