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

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

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

View Full Document Right Arrow Icon
Control Statements in MATLAB
Background image of page 1

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

View Full DocumentRight Arrow Icon
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)
Background image of page 2
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)
Background image of page 3

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

View Full DocumentRight Arrow Icon
If Elseif Statement if conditional_expression1 ... ... Elseif conditional_expression2 ... ... Else
Background image of page 4
Image of page 5
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 Right Arrow Icon
Ask a homework question - tutors are online