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
The Format Function and ellipsis: The default in MATLAB is to show numbers which have decimal places with four decimal places. The format command can be used to identify the o

Matlab Programming Vector Algebra : Create a program package for calculation of distances and intersections of lines and planes. Plot the results in a graphical representation

The purpose of this lab is to enhance the ECE311 student's understanding of filter behavior and filter design and to provide the student the opportunity to demonstrate skills in li

Variables and Assignment Statements: A variable is used in order to store a value in a MATLAB session, or in a program. The Workspace Window represents variables which have be

Functions which return More than one Value: Functions which return one value have one output argument. The Functions which return more than one value should rather have more t

You will write functions • B=null basis(A,tol); • B=range basis(A,tol); The function null basis takes a matrix A as input, and outputs a basis for the null space of A, obtained via

Functions with Local Variables: The functions we have seen faraway have been very easy. Though, in many situations the computations in a function are more complex, and may nee

A filter described by the equation:    y(n) = x(n) + x(n-1) + 0.9 y(n-1) - 0.81 y(n-2) (a) Find the transfer function H(z) for the filter and find the poles and zeros of the fil

how to model a diode in matlab given data

1. Enter the 3×4 matrix Let a ij denote the entry of A in the ith row and jth column. Use Matlab to compute the following : (a) a 13 + a 32 (b) Three times the