Lecture-29(matlab-if-and-logic)

# Lecture-29(matlab-if-and-logic) - Control Statements in...

This preview shows pages 1–5. Sign up to view the full content.

Control Statements in MATLAB

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
If Statement 3 variants of If Then Else statement if conditional_expression ... ... end If conditional expression is true, then evaluate the code within the block, otherwise pass the control to the line following the end d = input(‘Pipe id’) v = input(‘velocity’) ρ = input(‘density’) μ = input(‘viscosity’) Re = d*v*r/m If Re < 2500 disp(‘Flow is laminar’) end (I)
If Else Statement if conditional_expression ... ... else ... ... end If conditional expression is true, then evaluate the code between if and else, otherwise execute the code between Else and end d = input(‘Pipe id’) v = input(‘velocity’) ρ = input(‘density’) μ = input(‘viscosity’) Re = d*v*r/m If Re < 2500 disp(‘Flow is laminar’) Else disp(‘Flow is turbulent’) end (II)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
If Elseif Statement if conditional_expression1 ... ... Elseif conditional_expression2 ... ... Else
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/27/2008 for the course PGE 310f taught by Professor Srinivasan during the Spring '08 term at University of Texas.

### Page1 / 9

Lecture-29(matlab-if-and-logic) - Control Statements in...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online