Illustration of labels and prompts, MATLAB in Mathematics

Illustration of Labels and prompts:

The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, that is the point (xm, ym). The coordinates of the midpoint are found by:

776_Illustration of Labels and prompts.png

The script midpoint.m calls a function entercoords to individually prompt the user for the x- and y-coordinates of the two endpoints, calls the function findmid which computes individually the x- and y-coordinates of the midpoint, and then prints this midpoint. Whenever the program is executed, the output appears like this:

>> midpoint

Put the x coord of the first endpoint: 2

Set the y coord of the first endpoint: 4

Put the x coord of the second endpoint: 3

Set the y coord of the second endpoint: 8

The midpoint is (2.5, 6.0)

 

In this illustration, the word 'first' or 'second' is passed to the entercoords function so that it can use wherever the word is passed in prompt. The sprintf function creates this customized prompt.

779_Illustration of Labels and prompts1.png

2112_Illustration of Labels and prompts2.png

1264_Illustration of Labels and prompts3.png

 

Posted Date: 10/20/2012 5:23:26 AM | Location : United States







Related Discussions:- Illustration of labels and prompts, Assignment Help, Ask Question on Illustration of labels and prompts, Get Answer, Expert's Help, Illustration of labels and prompts Discussions

Write discussion on Illustration of labels and prompts
Your posts are moderated
Related Questions
strvcat function - concatenation: The function strvcat will concatenate it vertically, that means that it will generate a column vector of the strings.   >> strvcat(fir

Using Functions with the Vectors and Matrices: As MATLAB is written to work with the vectors and matrices, the whole vector or matrix can be passed as an argument to the funct

Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

sprintf function: The sprintf function works precisely like the fprintf function, but rather than printing it generates a string. Here are some illustrations in which the outp

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va