Unit-2 Engineering Computation With MATLAB
Unit-2 Engineering Computation With MATLAB
Introduction; Relational & Logical operations - Example programs - Operator precedence- Control
& Decision statements- IF - IF ELSE - NESTED IF ELSE - SWITCH - TRY &CATCH - FOR -
WHILE - NESTED FOR - FOR with IF statements, MATLAB programorganization, Debugging
methods - Error trapping using eval & lastern commands.
RELATIONAL OPERATORS
MATLAB relational operators include all common comparisons, as shown in thefollowing table:
LOGICAL OPERATORS
OPERATOR PRECEDENCE
LOOPS
for Loop
while loop
if Control Structure
if Structure
if-else Structure
if-elseif-else Structure
nested if Structure
switch Statement
break Statement
continue Statement
error Statement
try-catch Structure
Types of Errors
Displaying Warnings
MATLAB DEBUGGER
Setting Breakpoints
Examining Variables
SAMPLE QUESTIONS
2 marks
3. What is a breakpoint?
5 marks
1. Illustrate on the usage of relational operators along with mathematical expression with an example.
6. Explain the concepts of error handling using functions ‘eval’ and ‘lasterr’.
10 marks
1. Develop a MATLAB program to add the numbers till the number entered is 0, using while loop.
2. Develop a MATLAB program to find the largest of the three numbers using if-elseif-else structure.
3. Explain in detail about relational and logical operators with example programs.