SlideShare a Scribd company logo
Logical Vectors and
      Strings
• TYPE as it is in Command Line :
   r=1; Chk result
  r<=.5
   ( Result is 0)
   and then at last
   r>=.5
( Result is 1)

Now Enter the Following statement :

r = 1:5;
r<=3

U get 11100 as statement is true for first 3 elements
• Vectors are compared element by element
  and the resulting vector is called as Logical
  Vector. It is one of the most power concepts in
  MATLAB.

• For eg try this :
a=1:5;
b=[0 2 3 5 6];
a==b % no semicolon (Result is :
0 1 1 0 0)
• Applications :
Discontinuous Graphs :




Type these Statements :
x=0:pi/20:3*pi;
y=sin(x);
y=y .* (y>0);
plot(x,y)
• What was the Funda ???
y>0 returns a logical vector with ones where sin(x)
  is positive as y>0 means it is checked element
  by element if it is >0 ; and if it is not then it
  returns 0.

After this we multiply by y to get the graph
• Avoid division by 0




As one of the element of x is exact zero.
• Use Logical Vector to replace zero with eps.




What is eps?
• This MATLAB function returns the difference
  between 1.0 and the next largest number which
  can be represented in MATLAB, i.e.
  approximately 2.2e-16.
• So you type and get :
• Logical Functions :
x is a vector :
Try these statements :

x=1:5
any(x)

any(x) : returns scalar 1 in ans if any element of x
  is nonzero.
• Try for the o/p of
 x = [ 0 0]
any(x)

all(x)
Returns scalar 1 if all elements of vector x r non
   zero!
x=1:5;
all(x)
Try to get info abt all logic functions
• Strings :
• For Basic i/p o/p of string we have :

name = input( 'Enter your surname: ', 's' );

Chk the workspace

Now type

disp(name)
Logical vectors
Logical vectors
Logical vectors

More Related Content

What's hot

Divide and conquer 1
Divide and conquer 1Divide and conquer 1
Divide and conquer 1
Kumar
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
university of Gujrat, pakistan
 
Functions lect
Functions lectFunctions lect
Functions lect
AdnanBukhari13
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Hoang Nguyen
 
Lecture4
Lecture4Lecture4
Lecture4
Mohamed Awni
 
Counting sort
Counting sortCounting sort
Counting sort
zahraa F.Muhsen
 
L10 sorting-searching
L10 sorting-searchingL10 sorting-searching
L10 sorting-searching
mondalakash2012
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
despicable me
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Counting sort
Counting sortCounting sort
Counting sort
arjunnaik19
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
BG Java EE Course
 
Python decision making_loops_control statements part9
Python decision making_loops_control statements part9Python decision making_loops_control statements part9
Python decision making_loops_control statements part9
Vishal Dutt
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
Shweta Bhatia
 
Matlab on basic mathematics
Matlab on basic mathematicsMatlab on basic mathematics
Matlab on basic mathematics
monauweralam1
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and MatricesMATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
Shameer Ahmed Koya
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
LAKSHMITHARUN PONNAM
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Mohammed Hussein
 
Sorting & Linked Lists
Sorting & Linked ListsSorting & Linked Lists
Sorting & Linked Lists
J.T.A.JONES
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 

What's hot (20)

Divide and conquer 1
Divide and conquer 1Divide and conquer 1
Divide and conquer 1
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
 
Functions lect
Functions lectFunctions lect
Functions lect
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Lecture4
Lecture4Lecture4
Lecture4
 
Counting sort
Counting sortCounting sort
Counting sort
 
L10 sorting-searching
L10 sorting-searchingL10 sorting-searching
L10 sorting-searching
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Counting sort
Counting sortCounting sort
Counting sort
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
 
Python decision making_loops_control statements part9
Python decision making_loops_control statements part9Python decision making_loops_control statements part9
Python decision making_loops_control statements part9
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
 
Matlab on basic mathematics
Matlab on basic mathematicsMatlab on basic mathematics
Matlab on basic mathematics
 
MATLAB - Arrays and Matrices
MATLAB - Arrays and MatricesMATLAB - Arrays and Matrices
MATLAB - Arrays and Matrices
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Sorting & Linked Lists
Sorting & Linked ListsSorting & Linked Lists
Sorting & Linked Lists
 
Big o notation
Big o notationBig o notation
Big o notation
 

Viewers also liked

Michaelpritchard
MichaelpritchardMichaelpritchard
Michaelpritchard
michaelpritchard
 
Matlab
MatlabMatlab
Tech tut
Tech tutTech tut
VPN
VPNVPN
Improving your driveway, path or patio.
Improving  your driveway, path or patio.Improving  your driveway, path or patio.
Improving your driveway, path or patio.
WrexhamConcreteDesign
 
Michaelpritchard
MichaelpritchardMichaelpritchard
Michaelpritchard
michaelpritchard
 
Lec2
Lec2Lec2
Matlab
MatlabMatlab
Lec1
Lec1Lec1
Fb Nnew Pps
Fb Nnew PpsFb Nnew Pps
Fb Nnew Pps
Dear CD
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
Ketan Paithankar
 
SIB Green IT Policy
SIB Green IT PolicySIB Green IT Policy
SIB Green IT Policy
swiss IT bridge
 
BarCamp in Saigon
BarCamp in SaigonBarCamp in Saigon
BarCamp in Saigon
swiss IT bridge
 
Introduction into GIT
Introduction into GITIntroduction into GIT
Introduction into GIT
swiss IT bridge
 
An approach to implement model classes in zend
An approach to implement model classes in zendAn approach to implement model classes in zend
An approach to implement model classes in zend
swiss IT bridge
 
Los espacios en la BECREA. junta de andalucía.
Los espacios en la BECREA. junta de andalucía.Los espacios en la BECREA. junta de andalucía.
Los espacios en la BECREA. junta de andalucía.
Biblioteca Escolar Juan Leiva
 
Servicios tradicionales en la BECREA
Servicios tradicionales en la BECREAServicios tradicionales en la BECREA
Servicios tradicionales en la BECREA
Biblioteca Escolar Juan Leiva
 
How to apply Agile in Marketing
How to apply Agile in MarketingHow to apply Agile in Marketing
How to apply Agile in Marketing
swiss IT bridge
 
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
Biblioteca Escolar Juan Leiva
 
Client Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvementClient Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvement
swiss IT bridge
 

Viewers also liked (20)

Michaelpritchard
MichaelpritchardMichaelpritchard
Michaelpritchard
 
Matlab
MatlabMatlab
Matlab
 
Tech tut
Tech tutTech tut
Tech tut
 
VPN
VPNVPN
VPN
 
Improving your driveway, path or patio.
Improving  your driveway, path or patio.Improving  your driveway, path or patio.
Improving your driveway, path or patio.
 
Michaelpritchard
MichaelpritchardMichaelpritchard
Michaelpritchard
 
Lec2
Lec2Lec2
Lec2
 
Matlab
MatlabMatlab
Matlab
 
Lec1
Lec1Lec1
Lec1
 
Fb Nnew Pps
Fb Nnew PpsFb Nnew Pps
Fb Nnew Pps
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
 
SIB Green IT Policy
SIB Green IT PolicySIB Green IT Policy
SIB Green IT Policy
 
BarCamp in Saigon
BarCamp in SaigonBarCamp in Saigon
BarCamp in Saigon
 
Introduction into GIT
Introduction into GITIntroduction into GIT
Introduction into GIT
 
An approach to implement model classes in zend
An approach to implement model classes in zendAn approach to implement model classes in zend
An approach to implement model classes in zend
 
Los espacios en la BECREA. junta de andalucía.
Los espacios en la BECREA. junta de andalucía.Los espacios en la BECREA. junta de andalucía.
Los espacios en la BECREA. junta de andalucía.
 
Servicios tradicionales en la BECREA
Servicios tradicionales en la BECREAServicios tradicionales en la BECREA
Servicios tradicionales en la BECREA
 
How to apply Agile in Marketing
How to apply Agile in MarketingHow to apply Agile in Marketing
How to apply Agile in Marketing
 
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
GUÍA DE BIBLIOTECAS ESCOLARES. 6. Extensión cultural. Director: José García G...
 
Client Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvementClient Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvement
 

Similar to Logical vectors

2. Chap 1.pptx
2. Chap 1.pptx2. Chap 1.pptx
2. Chap 1.pptx
HassanShah396906
 
Matlab practical ---4.pdf
Matlab practical ---4.pdfMatlab practical ---4.pdf
Matlab practical ---4.pdf
Central university of Haryana
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
lyra matalubos
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
svrohith 9
 
bisection method
bisection methodbisection method
bisection method
Muhammad Usama
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
reddyprasad reddyvari
 
Presentación grupo 551108 30
Presentación grupo 551108 30Presentación grupo 551108 30
Presentación grupo 551108 30
njhernandez19
 
Exponents
ExponentsExponents
Exponents
Tankiso Tale
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
joellivz
 
Matlab for marketing people
Matlab for marketing peopleMatlab for marketing people
Matlab for marketing people
Toshiaki Takeuchi
 
Domain and range (linear, quadratic, rational functions)
Domain and range (linear, quadratic, rational functions)Domain and range (linear, quadratic, rational functions)
Domain and range (linear, quadratic, rational functions)
Rose Mary Tania Arini
 
Lec3
Lec3Lec3
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
bilawalali74
 
Functions lesson
Functions lesson Functions lesson
Functions lesson
YesseniaVillalobos2
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
nourhandardeer3
 
Matlab1
Matlab1Matlab1
Matlab1
guest8ba004
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
Amr Rashed
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
raghav415187
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
chestialtaff
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
kebeAman
 

Similar to Logical vectors (20)

2. Chap 1.pptx
2. Chap 1.pptx2. Chap 1.pptx
2. Chap 1.pptx
 
Matlab practical ---4.pdf
Matlab practical ---4.pdfMatlab practical ---4.pdf
Matlab practical ---4.pdf
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
 
bisection method
bisection methodbisection method
bisection method
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Presentación grupo 551108 30
Presentación grupo 551108 30Presentación grupo 551108 30
Presentación grupo 551108 30
 
Exponents
ExponentsExponents
Exponents
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
 
Matlab for marketing people
Matlab for marketing peopleMatlab for marketing people
Matlab for marketing people
 
Domain and range (linear, quadratic, rational functions)
Domain and range (linear, quadratic, rational functions)Domain and range (linear, quadratic, rational functions)
Domain and range (linear, quadratic, rational functions)
 
Lec3
Lec3Lec3
Lec3
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
 
Functions lesson
Functions lesson Functions lesson
Functions lesson
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
Matlab1
Matlab1Matlab1
Matlab1
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 

Recently uploaded

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 

Logical vectors

  • 2. • TYPE as it is in Command Line : r=1; Chk result r<=.5 ( Result is 0) and then at last r>=.5 ( Result is 1) Now Enter the Following statement : r = 1:5; r<=3 U get 11100 as statement is true for first 3 elements
  • 3. • Vectors are compared element by element and the resulting vector is called as Logical Vector. It is one of the most power concepts in MATLAB. • For eg try this : a=1:5; b=[0 2 3 5 6]; a==b % no semicolon (Result is : 0 1 1 0 0)
  • 4. • Applications : Discontinuous Graphs : Type these Statements : x=0:pi/20:3*pi; y=sin(x); y=y .* (y>0); plot(x,y)
  • 5. • What was the Funda ??? y>0 returns a logical vector with ones where sin(x) is positive as y>0 means it is checked element by element if it is >0 ; and if it is not then it returns 0. After this we multiply by y to get the graph
  • 6. • Avoid division by 0 As one of the element of x is exact zero.
  • 7. • Use Logical Vector to replace zero with eps. What is eps? • This MATLAB function returns the difference between 1.0 and the next largest number which can be represented in MATLAB, i.e. approximately 2.2e-16.
  • 8. • So you type and get :
  • 9.
  • 10. • Logical Functions : x is a vector : Try these statements : x=1:5 any(x) any(x) : returns scalar 1 in ans if any element of x is nonzero.
  • 11. • Try for the o/p of x = [ 0 0] any(x) all(x) Returns scalar 1 if all elements of vector x r non zero! x=1:5; all(x) Try to get info abt all logic functions
  • 12.
  • 14. • For Basic i/p o/p of string we have : name = input( 'Enter your surname: ', 's' ); Chk the workspace Now type disp(name)