Illustrations of if statement, MATLAB Programming

Illustrations of if statement:

illustrations of running this script:

>> sqrtifexamp

Please enter a number: -4.2

The sqrt of 4.2 is 2.0

>> sqrtifexamp

Please enter a number: 1.44

The sqrt of 1.4 is 1.2

In this situation, the action of the if statement was a single assignment statement.

The action can be several numbers of valid statements. For illustration, we might wish to print a note to the user to state that the number entered was being changed.

959_Illustrations of if statement.png

>> sqrtifexampii

Please enter a number: -25

OK, we will use the absolute value

The sqrt of 25.0 is 5.0

Note that the use of two single quotes in the disp statement in order to print the one single quote.

Posted Date: 10/19/2012 3:16:18 AM | Location : United States







Related Discussions:- Illustrations of if statement, Assignment Help, Ask Question on Illustrations of if statement, Get Answer, Expert's Help, Illustrations of if statement Discussions

Write discussion on Illustrations of if statement
Your posts are moderated
Related Questions
Implement a MatLab function to calculate y.  The function should take two input arguments 1) A vector of parameters In the above example this would be of length 3, the first

Illustration of Output statements: For illustration, >> disp('Hello') Hello >> disp(4^3)   64 The formatted output can be printed to the screen by using the fpr

Given the following image, 1 2 1 1 2 0 0 1 5 1 0 1

In this lab, we study the three concepts. Vector is used to store more than one value into single variable. It is similar to array (other programming language). Script is a collect

write a function program to compute a standard deviation of a number

Write a MATLAB program to find the undamped natural frequencies and modes of an electric car treating it as a four degree of freedom system. Determine the undamped natural frequenc

The average speed of vehicles on a freeway is being studied. Assume that the standard deviation of vehicle speed is known to be 8 km/h. (a) Suppose observations on 120 vehicles


Passing Multiple Arguments: In many situaion it is essential to pass more than one argument to the function. For illustration, the volume of a cone is given by here r

We wish to numerically perform the following integration: (a) Use Matlab's quad function to perform the above integral. (b) Analytically evaluate the integral (e.g. do t