SlideShare a Scribd company logo
1 of 11
Matlabassignmenhelp
While Loop in
MATLAB
"A Complete Solution
for The Beginners"
Outline
Overview
Syntax of while loop in MATLAB
Flow diagram of the while loop
statement
How while loop is used in MATLAB
Some examples of the while loop with
output
Conclusion
Overview
Matlab is one of the scientific programming languages that is used for various
academic and research purposes. There are several industries that are using this
language, but research organizations and universities are the main clients for this
programming tool. This language is developed by Mathworks. To use this
programming language, one has to purchase its license, but for the beginners as
well as for the students, it comes with a trial version for the limited period. Here
we are going to share with you the while loop in MATLAB.
Matlab has renowned in various universities and colleges because it is used for
scientific computations like signal processing, advanced mathematics, control
system, and much more.
Syntax
of while
loop in
MATLAB
Here, we have mentioned the syntax of the while loop
with the appropriate steps method.
While expression
Statements
End
• The keyword for while loop is ‘While’.
• To work with the while loop, the
expression should be true.
• The statement is the action that can be
executed if the expression is true.
• The end is the closed-loop of the
statement.
Syntax:
Syntax:
a= 20;
% while loop execution
while( a <30)
fprintf (‘value of a: %dn’, a);
a= a+2;
end
We defined a single variable that is equal to 20.
A % line is the command line in Matlab; therefore, we can ignore this
statement.
While loop has the initial value that is less than 30, which means that the
while loop will execute the value until less than 30.
The next statement will print the value of a. The statement a = a+2 will add
2 to the initial value of a. And it will execute the values till 30.
Example:–
Explanation of the examples
The above-mentioned flow diagram is
self-explanatory and quite simple to
understand. It is similar to the steps that
are described in the syntax column.
Whenever a boolean expression is true,
the statement will be executed; otherwise,
it will return a null value.
Flow diagram
of the while
loop
statement:-
How while
loop is used
in Matlab
• There must be some boolean expression that has
to be executed by the loop.
• The boolean expression should have some action,
that may be true or false.
• The loop control will move as per the nature of
the expression, that is, either it will execute, or it
will stop working.
A while loop has various parts that require to
understand:
We have already explained the working of the while
loop through the flow diagram and syntax
explanation. Now, we will discuss the overall working
of the while loop in Matlab.
Some examples of the while loop
with output
Example
i = 2;
while (i < 5)
i
i = i + 1;
end
Output :
–i = 3
i = 4
Conclusion
We hope that this blog will help you
out to understand the use of while
loop in Matlab with the examples and
explanation. We advise you to
execute the above-mentioned
programs and check the output of the
following. By which you can easily
understand the working by using while
loop in Matlab. The coding of the
programming language depends on
the practice, so the more you
practice, the more you can
understand these languages.
Follow Us on Social Media
@matlabassignmenthelp @matlabassignmenthelp @matlabassignmenthelp
Contact Us
www.matlabassignmenthelp.com
Info@matlabassignmenthelp.com

More Related Content

What's hot

MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3reddyprasad reddyvari
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in pythonManish Tomar
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & ImplementationGaditek
 
Basic concepts of parallelization
Basic concepts of parallelizationBasic concepts of parallelization
Basic concepts of parallelizationsnegacmr
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlabrishiteta
 
MATLAB Simulation for Master Thesis
MATLAB Simulation for Master ThesisMATLAB Simulation for Master Thesis
MATLAB Simulation for Master ThesisPhdtopiccom
 
Automata based-programming
Automata based-programmingAutomata based-programming
Automata based-programmingShaheer Ahmed
 
Machine Learning Projects Using MATLAB Research Help
Machine Learning Projects Using MATLAB Research HelpMachine Learning Projects Using MATLAB Research Help
Machine Learning Projects Using MATLAB Research HelpMatlab Simulation
 
Parallel programming in modern world .net technics shared
Parallel programming in modern world .net technics   sharedParallel programming in modern world .net technics   shared
Parallel programming in modern world .net technics sharedIT Weekend
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - IntroductionMadhu Bala
 
Topic 1.4: Randomized Algorithms
Topic 1.4: Randomized AlgorithmsTopic 1.4: Randomized Algorithms
Topic 1.4: Randomized AlgorithmsKM Bappi
 
Circuit analysis i with matlab computing and simulink sim powersystems modeling
Circuit analysis i with matlab computing and simulink sim powersystems modelingCircuit analysis i with matlab computing and simulink sim powersystems modeling
Circuit analysis i with matlab computing and simulink sim powersystems modelingIndra S Wahyudi
 
Fundamentals of algorithms
Fundamentals of algorithmsFundamentals of algorithms
Fundamentals of algorithmsAmit Kumar Rathi
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesFellowBuddy.com
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchartlotlot
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notationirdginfo
 
Big o notation
Big o notationBig o notation
Big o notationkeb97
 
MATLAB Thesis Projects
MATLAB Thesis ProjectsMATLAB Thesis Projects
MATLAB Thesis ProjectsPhdtopiccom
 

What's hot (20)

MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3MATLAB/SIMULINK for engineering applications: day 3
MATLAB/SIMULINK for engineering applications: day 3
 
Functional programming ideas in python
Functional programming ideas in pythonFunctional programming ideas in python
Functional programming ideas in python
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
 
Basic concepts of parallelization
Basic concepts of parallelizationBasic concepts of parallelization
Basic concepts of parallelization
 
Amortized analysis
Amortized analysisAmortized analysis
Amortized analysis
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlab
 
MATLAB Simulation for Master Thesis
MATLAB Simulation for Master ThesisMATLAB Simulation for Master Thesis
MATLAB Simulation for Master Thesis
 
Automata based-programming
Automata based-programmingAutomata based-programming
Automata based-programming
 
Machine Learning Projects Using MATLAB Research Help
Machine Learning Projects Using MATLAB Research HelpMachine Learning Projects Using MATLAB Research Help
Machine Learning Projects Using MATLAB Research Help
 
Parallel programming in modern world .net technics shared
Parallel programming in modern world .net technics   sharedParallel programming in modern world .net technics   shared
Parallel programming in modern world .net technics shared
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
 
Topic 1.4: Randomized Algorithms
Topic 1.4: Randomized AlgorithmsTopic 1.4: Randomized Algorithms
Topic 1.4: Randomized Algorithms
 
Circuit analysis i with matlab computing and simulink sim powersystems modeling
Circuit analysis i with matlab computing and simulink sim powersystems modelingCircuit analysis i with matlab computing and simulink sim powersystems modeling
Circuit analysis i with matlab computing and simulink sim powersystems modeling
 
Fundamentals of algorithms
Fundamentals of algorithmsFundamentals of algorithms
Fundamentals of algorithms
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
 
Neural Machine Translation Intro
Neural Machine Translation IntroNeural Machine Translation Intro
Neural Machine Translation Intro
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Big o notation
Big o notationBig o notation
Big o notation
 
MATLAB Thesis Projects
MATLAB Thesis ProjectsMATLAB Thesis Projects
MATLAB Thesis Projects
 

Similar to A Complete Guide on While Loop in MATLAB

While loop and for loop 06 (js)
While loop and for loop 06 (js)While loop and for loop 06 (js)
While loop and for loop 06 (js)AbhishekMondal42
 
Matlab - Introduction and Basics
Matlab - Introduction and BasicsMatlab - Introduction and Basics
Matlab - Introduction and BasicsTechsparks
 
Introduction_to_Matlab_lecture.pptx
Introduction_to_Matlab_lecture.pptxIntroduction_to_Matlab_lecture.pptx
Introduction_to_Matlab_lecture.pptxaboma2hawi
 
Programming Sessions KU Leuven - Session 03
Programming Sessions KU Leuven - Session 03Programming Sessions KU Leuven - Session 03
Programming Sessions KU Leuven - Session 03Rafael Camacho Dejay
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)Retheesh Raj
 
classVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxclassVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxssusere336f4
 
MATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptMATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptssuserdee4d8
 
On Applying Or-Parallelism and Tabling to Logic Programs
On Applying Or-Parallelism and Tabling to Logic ProgramsOn Applying Or-Parallelism and Tabling to Logic Programs
On Applying Or-Parallelism and Tabling to Logic ProgramsLino Possamai
 
From zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyondFrom zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyondMahuaPal6
 
interfacing matlab with embedded systems
interfacing matlab with embedded systemsinterfacing matlab with embedded systems
interfacing matlab with embedded systemsRaghav Shetty
 

Similar to A Complete Guide on While Loop in MATLAB (20)

Matlab practical ---3.pdf
Matlab practical ---3.pdfMatlab practical ---3.pdf
Matlab practical ---3.pdf
 
While loop and for loop 06 (js)
While loop and for loop 06 (js)While loop and for loop 06 (js)
While loop and for loop 06 (js)
 
3.pdf
3.pdf3.pdf
3.pdf
 
Mbd dd
Mbd ddMbd dd
Mbd dd
 
Matlab - Introduction and Basics
Matlab - Introduction and BasicsMatlab - Introduction and Basics
Matlab - Introduction and Basics
 
Introduction_to_Matlab_lecture.pptx
Introduction_to_Matlab_lecture.pptxIntroduction_to_Matlab_lecture.pptx
Introduction_to_Matlab_lecture.pptx
 
Matlab guide
Matlab guideMatlab guide
Matlab guide
 
Programming Sessions KU Leuven - Session 03
Programming Sessions KU Leuven - Session 03Programming Sessions KU Leuven - Session 03
Programming Sessions KU Leuven - Session 03
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
 
Matopt
MatoptMatopt
Matopt
 
C language (Part 2)
C language (Part 2)C language (Part 2)
C language (Part 2)
 
classVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptxclassVII_Coding_Teacher_Presentation.pptx
classVII_Coding_Teacher_Presentation.pptx
 
Matlab
Matlab Matlab
Matlab
 
MATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptMATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.ppt
 
Basic matlab for beginners
Basic matlab for beginnersBasic matlab for beginners
Basic matlab for beginners
 
On Applying Or-Parallelism and Tabling to Logic Programs
On Applying Or-Parallelism and Tabling to Logic ProgramsOn Applying Or-Parallelism and Tabling to Logic Programs
On Applying Or-Parallelism and Tabling to Logic Programs
 
Assignment On Matlab
Assignment On MatlabAssignment On Matlab
Assignment On Matlab
 
From zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyondFrom zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyond
 
ch5.ppt
ch5.pptch5.ppt
ch5.ppt
 
interfacing matlab with embedded systems
interfacing matlab with embedded systemsinterfacing matlab with embedded systems
interfacing matlab with embedded systems
 

More from matlabassignmenthelp1

5 Programming Languages for Databases to Learn In 2023.pptx
5 Programming Languages for Databases to Learn In 2023.pptx5 Programming Languages for Databases to Learn In 2023.pptx
5 Programming Languages for Databases to Learn In 2023.pptxmatlabassignmenthelp1
 
Top Uses of Data Science in Education You Need to Know.pptx
Top Uses of Data Science in Education You Need to Know.pptxTop Uses of Data Science in Education You Need to Know.pptx
Top Uses of Data Science in Education You Need to Know.pptxmatlabassignmenthelp1
 
What are the Best Ways to Learn Programming In 2023.pptx
What are the Best Ways to Learn Programming In 2023.pptxWhat are the Best Ways to Learn Programming In 2023.pptx
What are the Best Ways to Learn Programming In 2023.pptxmatlabassignmenthelp1
 
Top 5 Hardest Programming Languages to Learn In 2023.pptx
Top 5 Hardest Programming Languages to Learn In 2023.pptxTop 5 Hardest Programming Languages to Learn In 2023.pptx
Top 5 Hardest Programming Languages to Learn In 2023.pptxmatlabassignmenthelp1
 
Best Steps on How to Get Good Grades in Middle School.pptx
Best Steps on How to Get Good Grades in Middle School.pptxBest Steps on How to Get Good Grades in Middle School.pptx
Best Steps on How to Get Good Grades in Middle School.pptxmatlabassignmenthelp1
 
5 Programming Languages for Automation In 2022.pptx
5 Programming Languages for Automation In 2022.pptx5 Programming Languages for Automation In 2022.pptx
5 Programming Languages for Automation In 2022.pptxmatlabassignmenthelp1
 
Programming languages for AI Development.pptx
Programming languages for AI Development.pptxProgramming languages for AI Development.pptx
Programming languages for AI Development.pptxmatlabassignmenthelp1
 
Top 12 Beneficial Uses of Matlab.pptx
Top 12 Beneficial Uses of Matlab.pptxTop 12 Beneficial Uses of Matlab.pptx
Top 12 Beneficial Uses of Matlab.pptxmatlabassignmenthelp1
 
A definitive guide on math works matlab to the students
A definitive guide on math works matlab to the studentsA definitive guide on math works matlab to the students
A definitive guide on math works matlab to the studentsmatlabassignmenthelp1
 

More from matlabassignmenthelp1 (11)

5 Programming Languages for Databases to Learn In 2023.pptx
5 Programming Languages for Databases to Learn In 2023.pptx5 Programming Languages for Databases to Learn In 2023.pptx
5 Programming Languages for Databases to Learn In 2023.pptx
 
Top Uses of Data Science in Education You Need to Know.pptx
Top Uses of Data Science in Education You Need to Know.pptxTop Uses of Data Science in Education You Need to Know.pptx
Top Uses of Data Science in Education You Need to Know.pptx
 
What are the Best Ways to Learn Programming In 2023.pptx
What are the Best Ways to Learn Programming In 2023.pptxWhat are the Best Ways to Learn Programming In 2023.pptx
What are the Best Ways to Learn Programming In 2023.pptx
 
Top 5 Hardest Programming Languages to Learn In 2023.pptx
Top 5 Hardest Programming Languages to Learn In 2023.pptxTop 5 Hardest Programming Languages to Learn In 2023.pptx
Top 5 Hardest Programming Languages to Learn In 2023.pptx
 
Best Steps on How to Get Good Grades in Middle School.pptx
Best Steps on How to Get Good Grades in Middle School.pptxBest Steps on How to Get Good Grades in Middle School.pptx
Best Steps on How to Get Good Grades in Middle School.pptx
 
5 Programming Languages for Automation In 2022.pptx
5 Programming Languages for Automation In 2022.pptx5 Programming Languages for Automation In 2022.pptx
5 Programming Languages for Automation In 2022.pptx
 
Programming languages for AI Development.pptx
Programming languages for AI Development.pptxProgramming languages for AI Development.pptx
Programming languages for AI Development.pptx
 
Top 12 Beneficial Uses of Matlab.pptx
Top 12 Beneficial Uses of Matlab.pptxTop 12 Beneficial Uses of Matlab.pptx
Top 12 Beneficial Uses of Matlab.pptx
 
How To Become a Java Developer.pdf
How To Become a Java Developer.pdfHow To Become a Java Developer.pdf
How To Become a Java Developer.pdf
 
A definitive guide on math works matlab to the students
A definitive guide on math works matlab to the studentsA definitive guide on math works matlab to the students
A definitive guide on math works matlab to the students
 
Why is homework important
Why is homework importantWhy is homework important
Why is homework important
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

A Complete Guide on While Loop in MATLAB

  • 1. Matlabassignmenhelp While Loop in MATLAB "A Complete Solution for The Beginners"
  • 2. Outline Overview Syntax of while loop in MATLAB Flow diagram of the while loop statement How while loop is used in MATLAB Some examples of the while loop with output Conclusion
  • 3. Overview Matlab is one of the scientific programming languages that is used for various academic and research purposes. There are several industries that are using this language, but research organizations and universities are the main clients for this programming tool. This language is developed by Mathworks. To use this programming language, one has to purchase its license, but for the beginners as well as for the students, it comes with a trial version for the limited period. Here we are going to share with you the while loop in MATLAB. Matlab has renowned in various universities and colleges because it is used for scientific computations like signal processing, advanced mathematics, control system, and much more.
  • 4. Syntax of while loop in MATLAB Here, we have mentioned the syntax of the while loop with the appropriate steps method. While expression Statements End • The keyword for while loop is ‘While’. • To work with the while loop, the expression should be true. • The statement is the action that can be executed if the expression is true. • The end is the closed-loop of the statement. Syntax: Syntax:
  • 5. a= 20; % while loop execution while( a <30) fprintf (‘value of a: %dn’, a); a= a+2; end We defined a single variable that is equal to 20. A % line is the command line in Matlab; therefore, we can ignore this statement. While loop has the initial value that is less than 30, which means that the while loop will execute the value until less than 30. The next statement will print the value of a. The statement a = a+2 will add 2 to the initial value of a. And it will execute the values till 30. Example:– Explanation of the examples
  • 6. The above-mentioned flow diagram is self-explanatory and quite simple to understand. It is similar to the steps that are described in the syntax column. Whenever a boolean expression is true, the statement will be executed; otherwise, it will return a null value. Flow diagram of the while loop statement:-
  • 7. How while loop is used in Matlab • There must be some boolean expression that has to be executed by the loop. • The boolean expression should have some action, that may be true or false. • The loop control will move as per the nature of the expression, that is, either it will execute, or it will stop working. A while loop has various parts that require to understand: We have already explained the working of the while loop through the flow diagram and syntax explanation. Now, we will discuss the overall working of the while loop in Matlab.
  • 8. Some examples of the while loop with output Example i = 2; while (i < 5) i i = i + 1; end Output : –i = 3 i = 4
  • 9. Conclusion We hope that this blog will help you out to understand the use of while loop in Matlab with the examples and explanation. We advise you to execute the above-mentioned programs and check the output of the following. By which you can easily understand the working by using while loop in Matlab. The coding of the programming language depends on the practice, so the more you practice, the more you can understand these languages.
  • 10. Follow Us on Social Media @matlabassignmenthelp @matlabassignmenthelp @matlabassignmenthelp