SlideShare a Scribd company logo
SESSION-4 :MATLAB
Conditional Statements
By: Prof. Ganesh Ingle
Session objective
Introdcution
Operators
Conditional Statements
If, if else, if elseif else and nested statements
Switch case statement
Menu driven Program
SUMMARY
Operators
Sr.No. Operator & Description
1 < Less than
2 <= Less than or equal to
3 > Greater than
4 >= Greater than or equal to
5 == Equal to
6 ~= Not equal to
p q p & q p | q p ^ q
0 0 0 0 0
0 1 0 1 1
1 1 1 1 0
1 0 0 1 1
Logical OperatorsRelational Operators
Operators
Sr.No. Operator & Description
1
+
Addition or unary plus. A+B adds the values stored in variables A and B. A and B must have the
same size, unless one is a scalar. A scalar can be added to a matrix of any size.
2
-
Subtraction or unary minus. A-B subtracts the value of B from A. A and B must have the same
size, unless one is a scalar. A scalar can be subtracted from a matrix of any size.
3
*
Matrix multiplication. C = A*B is the linear algebraic product of the matrices A and B. More
precisely,
For non-scalar A and B, the number of columns of A must be equal to the number of rows of B.
A scalar can multiply a matrix of any size.
4
.*
Array multiplication. A.*B is the element-by-element product of the arrays A and B. A and B
must have the same size, unless one of them is a scalar.
5
/
Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A =
(A'B')'.
6
./
Array right division. A./B is the matrix with elements A(i,j)/B(i,j). A and B must have the same
size, unless one of them is a scalar.
Operators
Sr.No. Operator & Description
7

Backslash or matrix left division. If A is a square matrix, AB is roughly the same as inv(A)*B,
except it is computed in a different way. If A is an n-by-n matrix and B is a column vector with n
components, or a matrix with several such columns, then X = AB is the solution to the equation
AX = B. A warning message is displayed if A is badly scaled or nearly singular.
8
.
Array left division. A.B is the matrix with elements B(i,j)/A(i,j). A and B must have the same
size, unless one of them is a scalar.
9
^
Matrix power. X^p is X to the power p, if p is a scalar. If p is an integer, the power is computed by
repeated squaring. If the integer is negative, X is inverted first. For other values of p, the
calculation involves eigenvalues and eigenvectors, such that if [V,D] = eig(X), then X^p =
V*D.^p/V.
10
.^
Array power. A.^B is the matrix with elements A(i,j) to the B(i,j) power. A and B must have the
same size, unless one of them is a scalar.
11
'
Matrix transpose. A' is the linear algebraic transpose of A. For complex matrices, this is the
complex conjugate transpose.
12
.'
Array transpose. A.' is the array transpose of A. For complex matrices, this does not involve
conjugation.
Conditional Statement
Definition: A conditional statement, symbolized by p q, is an if-then
statement in which p is a hypothesis and q is a conclusion. The logical
connector in a conditional statement is denoted by the symbol . The
conditional is defined to be true unless a true hypothesis leads to a false
conclusion.
Types of conditional statements:
1. If
2. If else
3. If elseif else ladder
4. Nested if else
5. Switch case statement
if Statement
if Statement
%program to check the largest number
among two
a=input('Enter the firt number :');
b=input('Enter the firt number :');
if(a>b)
disp('a is greatest');
end
if(a<b)
disp('b is greatest');
end
if(a==b)
disp('both are equal');
end
if else Statement
If the conditional expression is an array, it is true only if all the elements of the array are true!
if else Statement
If the conditional expression is an array, it is true only if all the elements of the array are true!
%program to check the largest number
among two distinct numbers
a=input('Enter the firt number :');
b=input('Enter the firt number :');
if(a>b)
disp('a is greatest');
else
disp('b is greatest');
end
if elseif else Statement
if elseif else Statement
if elseif else Statement
%program to check the largest
number among two
a=input('Enter the firt number :');
b=input('Enter the firt number :');
if(a>b)
disp('a is greatest');
elseif(a<b)
disp('b is greatest');
else
disp('both are equal');
end
if elseif else Statement
Nested if else Statement
Switch Case Statement
Switch Case Statement
%calculator program using switch case construct menu driven
a=input('Enter the firt number :');
b=input('Enter the second number :');
fprintf('Enter choice 1 if you want to perform addition of two numbers n');
fprintf('Enter choice 2 if you want to perform subtraction of two numbers n');
fprintf('Enter choice 3 if you want to perform multiplication of two numbers n');
fprintf('Enter choice 4 if you want to perform division of two numbers n');
choice=input('Enter the choice :');
switch (choice)
case 1
add=a+b;disp('The addtion of two number is');disp(add);
case 2
sub=a-b;disp('The Subtraction of two number is');disp(sub);
case 3
mult=a*b;disp('The multiplication of two number is');disp(mult);
case 4
div=a/b;disp('The Division of two number is');disp(div);
otherwise
disp('wrong choice');
end
THANK YOU
Image Source
searchenterpriseai.techtarget.com
wikipedia

More Related Content

What's hot (20)

Angle between 2 lines
Angle between 2 linesAngle between 2 lines
Angle between 2 lines
Simon Borgert
 
Bayes Theorem.pdf
Bayes Theorem.pdfBayes Theorem.pdf
Bayes Theorem.pdf
Nirmalavenkatachalam
 
Curve Fitting - Linear Algebra
Curve Fitting - Linear AlgebraCurve Fitting - Linear Algebra
Curve Fitting - Linear Algebra
Gowtham Cr
 
Application of eigen value eigen vector to design
Application of eigen value eigen vector to designApplication of eigen value eigen vector to design
Application of eigen value eigen vector to design
Home
 
Linear and non linear equation
Linear and non linear equationLinear and non linear equation
Linear and non linear equation
Harshana Madusanka Jayamaha
 
Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max Algorithm
Ujjawal Poudel
 
Bayesian Linear Regression.pptx
Bayesian Linear Regression.pptxBayesian Linear Regression.pptx
Bayesian Linear Regression.pptx
JerminJershaTC
 
02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability
Andres Mendez-Vazquez
 
GRAPH MATRIX APPLICATIONS.pdf
GRAPH MATRIX APPLICATIONS.pdfGRAPH MATRIX APPLICATIONS.pdf
GRAPH MATRIX APPLICATIONS.pdf
DurgaPrasad736072
 
Support vector regression and its application in trading
Support vector regression and its application in tradingSupport vector regression and its application in trading
Support vector regression and its application in trading
Aashay Harlalka
 
Binary Class and Multi Class Strategies for Machine Learning
Binary Class and Multi Class Strategies for Machine LearningBinary Class and Multi Class Strategies for Machine Learning
Binary Class and Multi Class Strategies for Machine Learning
Paxcel Technologies
 
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
QasimRehman
 
Linear regression
Linear regressionLinear regression
Linear regression
MartinHogg9
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
Kazuki Yoshida
 
Scope of engineering ethics2
Scope of engineering ethics2Scope of engineering ethics2
Scope of engineering ethics2
Peter Columa
 
Eigen value and eigen vector
Eigen value and eigen vectorEigen value and eigen vector
Eigen value and eigen vector
Rutvij Patel
 
Matlab Tutorial.ppt
Matlab Tutorial.pptMatlab Tutorial.ppt
Matlab Tutorial.ppt
RaviMuthamala1
 
Bayesian networks
Bayesian networksBayesian networks
Bayesian networks
Orochi Krizalid
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
Rogier Geertzema
 
AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)
Tajim Md. Niamat Ullah Akhund
 
Angle between 2 lines
Angle between 2 linesAngle between 2 lines
Angle between 2 lines
Simon Borgert
 
Curve Fitting - Linear Algebra
Curve Fitting - Linear AlgebraCurve Fitting - Linear Algebra
Curve Fitting - Linear Algebra
Gowtham Cr
 
Application of eigen value eigen vector to design
Application of eigen value eigen vector to designApplication of eigen value eigen vector to design
Application of eigen value eigen vector to design
Home
 
Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max Algorithm
Ujjawal Poudel
 
Bayesian Linear Regression.pptx
Bayesian Linear Regression.pptxBayesian Linear Regression.pptx
Bayesian Linear Regression.pptx
JerminJershaTC
 
02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability
Andres Mendez-Vazquez
 
GRAPH MATRIX APPLICATIONS.pdf
GRAPH MATRIX APPLICATIONS.pdfGRAPH MATRIX APPLICATIONS.pdf
GRAPH MATRIX APPLICATIONS.pdf
DurgaPrasad736072
 
Support vector regression and its application in trading
Support vector regression and its application in tradingSupport vector regression and its application in trading
Support vector regression and its application in trading
Aashay Harlalka
 
Binary Class and Multi Class Strategies for Machine Learning
Binary Class and Multi Class Strategies for Machine LearningBinary Class and Multi Class Strategies for Machine Learning
Binary Class and Multi Class Strategies for Machine Learning
Paxcel Technologies
 
Particle Swarm Optimization
Particle Swarm OptimizationParticle Swarm Optimization
Particle Swarm Optimization
QasimRehman
 
Linear regression
Linear regressionLinear regression
Linear regression
MartinHogg9
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
Kazuki Yoshida
 
Scope of engineering ethics2
Scope of engineering ethics2Scope of engineering ethics2
Scope of engineering ethics2
Peter Columa
 
Eigen value and eigen vector
Eigen value and eigen vectorEigen value and eigen vector
Eigen value and eigen vector
Rutvij Patel
 

Similar to Programming with matlab session 4 (20)

Ch3
Ch3Ch3
Ch3
aamirsahito
 
chap04-conditional.ppt
chap04-conditional.pptchap04-conditional.ppt
chap04-conditional.ppt
HeshamMohamed855920
 
3.pdf
3.pdf3.pdf
3.pdf
DEVENDRA PRATAP SINGH
 
Chapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptxChapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptx
danartalabani
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
Kathirvel Ayyaswamy
 
Mbd dd
Mbd ddMbd dd
Mbd dd
Aditya Choudhury
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
mcollison
 
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDIET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
IrlanMalik
 
Chaptfffffuuer05.PPT
Chaptfffffuuer05.PPTChaptfffffuuer05.PPT
Chaptfffffuuer05.PPT
sdvdsvsdvsvds
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
REHAN IJAZ
 
NUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMINGNUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMING
DHARANI A
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
04 a ch03_programacion
04 a ch03_programacion04 a ch03_programacion
04 a ch03_programacion
universidad del valle colombia
 
Chap 4 c++
Chap 4 c++Chap 4 c++
Chap 4 c++
Widad Jamaluddin
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
Saranya saran
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
Aswin Pv
 
Python notes for students to develop and learn
Python notes for students to develop and learnPython notes for students to develop and learn
Python notes for students to develop and learn
kavithaadhilakshmi
 
Fundamentals of Computer Programming - Flow of Control I
Fundamentals of Computer Programming - Flow of Control IFundamentals of Computer Programming - Flow of Control I
Fundamentals of Computer Programming - Flow of Control I
ChereLemma2
 
If statemet1
If statemet1If statemet1
If statemet1
sup11
 
Chapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptxChapter 3 - Programming in Matlab. aaaapptx
Chapter 3 - Programming in Matlab. aaaapptx
danartalabani
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
mcollison
 
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDIET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
ET DAH SI HAN HAN ADIKNYA SI WIDIANTORO RIBUT MULU SAMA ABANG WIDI
IrlanMalik
 
Chaptfffffuuer05.PPT
Chaptfffffuuer05.PPTChaptfffffuuer05.PPT
Chaptfffffuuer05.PPT
sdvdsvsdvsvds
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
REHAN IJAZ
 
NUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMINGNUMERICAL METHODS WITH MATLAB PROGRAMMING
NUMERICAL METHODS WITH MATLAB PROGRAMMING
DHARANI A
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
Saranya saran
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
Aswin Pv
 
Python notes for students to develop and learn
Python notes for students to develop and learnPython notes for students to develop and learn
Python notes for students to develop and learn
kavithaadhilakshmi
 
Fundamentals of Computer Programming - Flow of Control I
Fundamentals of Computer Programming - Flow of Control IFundamentals of Computer Programming - Flow of Control I
Fundamentals of Computer Programming - Flow of Control I
ChereLemma2
 
If statemet1
If statemet1If statemet1
If statemet1
sup11
 

More from Infinity Tech Solutions (20)

Database management system session 6
Database management system session 6Database management system session 6
Database management system session 6
Infinity Tech Solutions
 
Database management system session 5
Database management system session 5Database management system session 5
Database management system session 5
Infinity Tech Solutions
 
Database Management System-session 3-4-5
Database Management System-session 3-4-5Database Management System-session 3-4-5
Database Management System-session 3-4-5
Infinity Tech Solutions
 
Database Management System-session1-2
Database Management System-session1-2Database Management System-session1-2
Database Management System-session1-2
Infinity Tech Solutions
 
Main topic 3 problem solving and office automation
Main topic 3 problem solving and office automationMain topic 3 problem solving and office automation
Main topic 3 problem solving and office automation
Infinity Tech Solutions
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Infinity Tech Solutions
 
E commerce
E commerce E commerce
E commerce
Infinity Tech Solutions
 
E commerce
E commerceE commerce
E commerce
Infinity Tech Solutions
 
Bds session 13 14
Bds session 13 14Bds session 13 14
Bds session 13 14
Infinity Tech Solutions
 
Computer memory, Types of programming languages
Computer memory, Types of programming languagesComputer memory, Types of programming languages
Computer memory, Types of programming languages
Infinity Tech Solutions
 
Basic hardware familiarization
Basic hardware familiarizationBasic hardware familiarization
Basic hardware familiarization
Infinity Tech Solutions
 
User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
Infinity Tech Solutions
 
Programming with matlab session 6
Programming with matlab session 6Programming with matlab session 6
Programming with matlab session 6
Infinity Tech Solutions
 
Programming with matlab session 3 notes
Programming with matlab session 3 notesProgramming with matlab session 3 notes
Programming with matlab session 3 notes
Infinity Tech Solutions
 
AI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime SectorAI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime Sector
Infinity Tech Solutions
 
Programming with matlab session 5 looping
Programming with matlab session 5 loopingProgramming with matlab session 5 looping
Programming with matlab session 5 looping
Infinity Tech Solutions
 
BIG DATA Session 7 8
BIG DATA Session 7 8BIG DATA Session 7 8
BIG DATA Session 7 8
Infinity Tech Solutions
 
BIG DATA Session 6
BIG DATA Session 6BIG DATA Session 6
BIG DATA Session 6
Infinity Tech Solutions
 
MS word
MS word MS word
MS word
Infinity Tech Solutions
 
DBMS CS 4-5
DBMS CS 4-5DBMS CS 4-5
DBMS CS 4-5
Infinity Tech Solutions
 
Database Management System-session 3-4-5
Database Management System-session 3-4-5Database Management System-session 3-4-5
Database Management System-session 3-4-5
Infinity Tech Solutions
 
Main topic 3 problem solving and office automation
Main topic 3 problem solving and office automationMain topic 3 problem solving and office automation
Main topic 3 problem solving and office automation
Infinity Tech Solutions
 
Computer memory, Types of programming languages
Computer memory, Types of programming languagesComputer memory, Types of programming languages
Computer memory, Types of programming languages
Infinity Tech Solutions
 
AI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime SectorAI/ML/DL/BCT A Revolution in Maritime Sector
AI/ML/DL/BCT A Revolution in Maritime Sector
Infinity Tech Solutions
 
Programming with matlab session 5 looping
Programming with matlab session 5 loopingProgramming with matlab session 5 looping
Programming with matlab session 5 looping
Infinity Tech Solutions
 

Recently uploaded (20)

Software Engineering Unit 2 Power Point Presentation AKTU University
Software Engineering Unit 2 Power Point Presentation AKTU UniversitySoftware Engineering Unit 2 Power Point Presentation AKTU University
Software Engineering Unit 2 Power Point Presentation AKTU University
utkarshpandey8299
 
FTS under Indiandadsadsadsadsadsadsa DTAA.pdf
FTS under Indiandadsadsadsadsadsadsa DTAA.pdfFTS under Indiandadsadsadsadsadsadsa DTAA.pdf
FTS under Indiandadsadsadsadsadsadsa DTAA.pdf
HimanshuSharma779547
 
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Attenuation Models for Estimation of Vertical Peak Ground Acceleration Based ...
Journal of Soft Computing in Civil Engineering
 
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITSDE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
Sridhar191373
 
Scilab Chemical Engineering application.pptx
Scilab Chemical Engineering  application.pptxScilab Chemical Engineering  application.pptx
Scilab Chemical Engineering application.pptx
OmPandey85
 
A New Enhanced Hybrid Grey Wolf Optimizer (GWO) Combined with Elephant Herdin...
A New Enhanced Hybrid Grey Wolf Optimizer (GWO) Combined with Elephant Herdin...A New Enhanced Hybrid Grey Wolf Optimizer (GWO) Combined with Elephant Herdin...
A New Enhanced Hybrid Grey Wolf Optimizer (GWO) Combined with Elephant Herdin...
Journal of Soft Computing in Civil Engineering
 
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
Concept Learning - Find S Algorithm,Candidate Elimination AlgorithmConcept Learning - Find S Algorithm,Candidate Elimination Algorithm
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
Global Academy of Technology
 
Advanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of AdmixturesAdvanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of Admixtures
Bharti Shinde
 
Salesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for EveryoneSalesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for Everyone
ImtiazBinMohiuddin
 
Video Games and Artificial-Realities.pptx
Video Games and Artificial-Realities.pptxVideo Games and Artificial-Realities.pptx
Video Games and Artificial-Realities.pptx
HadiBadri1
 
PPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptxPPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptx
manesumit66
 
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine
 
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITSDIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
Sridhar191373
 
Air Filter Flat Sheet Media-Catalouge-Final.pdf
Air Filter Flat Sheet Media-Catalouge-Final.pdfAir Filter Flat Sheet Media-Catalouge-Final.pdf
Air Filter Flat Sheet Media-Catalouge-Final.pdf
FILTRATION ENGINEERING & CUNSULTANT
 
1.2 Need of Object-Oriented Programming.pdf
1.2 Need of Object-Oriented Programming.pdf1.2 Need of Object-Oriented Programming.pdf
1.2 Need of Object-Oriented Programming.pdf
VikasNirgude2
 
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivu___Machine Learning_Module 2pdfDr. Shivu___Machine Learning_Module 2pdf
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivashankar
 
1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf
VikasNirgude2
 
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdfParticle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
DUSABEMARIYA
 
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notesBEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
VarshithaP6
 
Introduction to Machine Vision by Cognex
Introduction to Machine Vision by CognexIntroduction to Machine Vision by Cognex
Introduction to Machine Vision by Cognex
RicardoCunha203173
 
Software Engineering Unit 2 Power Point Presentation AKTU University
Software Engineering Unit 2 Power Point Presentation AKTU UniversitySoftware Engineering Unit 2 Power Point Presentation AKTU University
Software Engineering Unit 2 Power Point Presentation AKTU University
utkarshpandey8299
 
FTS under Indiandadsadsadsadsadsadsa DTAA.pdf
FTS under Indiandadsadsadsadsadsadsa DTAA.pdfFTS under Indiandadsadsadsadsadsadsa DTAA.pdf
FTS under Indiandadsadsadsadsadsadsa DTAA.pdf
HimanshuSharma779547
 
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITSDE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
DE-UNIT-V MEMORY DEVICES AND DIGITAL INTEGRATED CIRCUITS
Sridhar191373
 
Scilab Chemical Engineering application.pptx
Scilab Chemical Engineering  application.pptxScilab Chemical Engineering  application.pptx
Scilab Chemical Engineering application.pptx
OmPandey85
 
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
Concept Learning - Find S Algorithm,Candidate Elimination AlgorithmConcept Learning - Find S Algorithm,Candidate Elimination Algorithm
Concept Learning - Find S Algorithm,Candidate Elimination Algorithm
Global Academy of Technology
 
Advanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of AdmixturesAdvanced Concrete Technology- Properties of Admixtures
Advanced Concrete Technology- Properties of Admixtures
Bharti Shinde
 
Salesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for EveryoneSalesforce Hackathon Fun Slide for Everyone
Salesforce Hackathon Fun Slide for Everyone
ImtiazBinMohiuddin
 
Video Games and Artificial-Realities.pptx
Video Games and Artificial-Realities.pptxVideo Games and Artificial-Realities.pptx
Video Games and Artificial-Realities.pptx
HadiBadri1
 
PPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptxPPT on Grid resilience against Natural disasters.pptx
PPT on Grid resilience against Natural disasters.pptx
manesumit66
 
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine, Issue 53 / Spring 2025
Better Builder Magazine
 
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITSDIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
DIGITAL ELECTRONICS: UNIT-III SYNCHRONOUS SEQUENTIAL CIRCUITS
Sridhar191373
 
1.2 Need of Object-Oriented Programming.pdf
1.2 Need of Object-Oriented Programming.pdf1.2 Need of Object-Oriented Programming.pdf
1.2 Need of Object-Oriented Programming.pdf
VikasNirgude2
 
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivu___Machine Learning_Module 2pdfDr. Shivu___Machine Learning_Module 2pdf
Dr. Shivu___Machine Learning_Module 2pdf
Dr. Shivashankar
 
1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf1.10 Functions in C++,call by value .pdf
1.10 Functions in C++,call by value .pdf
VikasNirgude2
 
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdfParticle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
Particle Swarm Optimization by Aleksandar Lazinica (Editor) (z-lib.org).pdf
DUSABEMARIYA
 
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notesBEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
BEC602- Module 3-2-Notes.pdf.Vlsi design and testing notes
VarshithaP6
 
Introduction to Machine Vision by Cognex
Introduction to Machine Vision by CognexIntroduction to Machine Vision by Cognex
Introduction to Machine Vision by Cognex
RicardoCunha203173
 

Programming with matlab session 4

  • 2. Session objective Introdcution Operators Conditional Statements If, if else, if elseif else and nested statements Switch case statement Menu driven Program SUMMARY
  • 3. Operators Sr.No. Operator & Description 1 < Less than 2 <= Less than or equal to 3 > Greater than 4 >= Greater than or equal to 5 == Equal to 6 ~= Not equal to p q p & q p | q p ^ q 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 Logical OperatorsRelational Operators
  • 4. Operators Sr.No. Operator & Description 1 + Addition or unary plus. A+B adds the values stored in variables A and B. A and B must have the same size, unless one is a scalar. A scalar can be added to a matrix of any size. 2 - Subtraction or unary minus. A-B subtracts the value of B from A. A and B must have the same size, unless one is a scalar. A scalar can be subtracted from a matrix of any size. 3 * Matrix multiplication. C = A*B is the linear algebraic product of the matrices A and B. More precisely, For non-scalar A and B, the number of columns of A must be equal to the number of rows of B. A scalar can multiply a matrix of any size. 4 .* Array multiplication. A.*B is the element-by-element product of the arrays A and B. A and B must have the same size, unless one of them is a scalar. 5 / Slash or matrix right division. B/A is roughly the same as B*inv(A). More precisely, B/A = (A'B')'. 6 ./ Array right division. A./B is the matrix with elements A(i,j)/B(i,j). A and B must have the same size, unless one of them is a scalar.
  • 5. Operators Sr.No. Operator & Description 7 Backslash or matrix left division. If A is a square matrix, AB is roughly the same as inv(A)*B, except it is computed in a different way. If A is an n-by-n matrix and B is a column vector with n components, or a matrix with several such columns, then X = AB is the solution to the equation AX = B. A warning message is displayed if A is badly scaled or nearly singular. 8 . Array left division. A.B is the matrix with elements B(i,j)/A(i,j). A and B must have the same size, unless one of them is a scalar. 9 ^ Matrix power. X^p is X to the power p, if p is a scalar. If p is an integer, the power is computed by repeated squaring. If the integer is negative, X is inverted first. For other values of p, the calculation involves eigenvalues and eigenvectors, such that if [V,D] = eig(X), then X^p = V*D.^p/V. 10 .^ Array power. A.^B is the matrix with elements A(i,j) to the B(i,j) power. A and B must have the same size, unless one of them is a scalar. 11 ' Matrix transpose. A' is the linear algebraic transpose of A. For complex matrices, this is the complex conjugate transpose. 12 .' Array transpose. A.' is the array transpose of A. For complex matrices, this does not involve conjugation.
  • 6. Conditional Statement Definition: A conditional statement, symbolized by p q, is an if-then statement in which p is a hypothesis and q is a conclusion. The logical connector in a conditional statement is denoted by the symbol . The conditional is defined to be true unless a true hypothesis leads to a false conclusion. Types of conditional statements: 1. If 2. If else 3. If elseif else ladder 4. Nested if else 5. Switch case statement
  • 8. if Statement %program to check the largest number among two a=input('Enter the firt number :'); b=input('Enter the firt number :'); if(a>b) disp('a is greatest'); end if(a<b) disp('b is greatest'); end if(a==b) disp('both are equal'); end
  • 9. if else Statement If the conditional expression is an array, it is true only if all the elements of the array are true!
  • 10. if else Statement If the conditional expression is an array, it is true only if all the elements of the array are true! %program to check the largest number among two distinct numbers a=input('Enter the firt number :'); b=input('Enter the firt number :'); if(a>b) disp('a is greatest'); else disp('b is greatest'); end
  • 11. if elseif else Statement
  • 12. if elseif else Statement
  • 13. if elseif else Statement %program to check the largest number among two a=input('Enter the firt number :'); b=input('Enter the firt number :'); if(a>b) disp('a is greatest'); elseif(a<b) disp('b is greatest'); else disp('both are equal'); end
  • 14. if elseif else Statement
  • 15. Nested if else Statement
  • 17. Switch Case Statement %calculator program using switch case construct menu driven a=input('Enter the firt number :'); b=input('Enter the second number :'); fprintf('Enter choice 1 if you want to perform addition of two numbers n'); fprintf('Enter choice 2 if you want to perform subtraction of two numbers n'); fprintf('Enter choice 3 if you want to perform multiplication of two numbers n'); fprintf('Enter choice 4 if you want to perform division of two numbers n'); choice=input('Enter the choice :'); switch (choice) case 1 add=a+b;disp('The addtion of two number is');disp(add); case 2 sub=a-b;disp('The Subtraction of two number is');disp(sub); case 3 mult=a*b;disp('The multiplication of two number is');disp(mult); case 4 div=a/b;disp('The Division of two number is');disp(div); otherwise disp('wrong choice'); end