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
Built-in functions for Complex numbers:   We know that in MATLAB both i and j are built-in functions which return √-1 (therefore, they can be thought of as built-in constants).

Differentiation: The derivative of a function y = f(x) can be written as follows or f  '(x) and is defined as the rate of change of the dependent variable y with respe

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

Find Minimum and Maximum for each row To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third arg

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

5 p2+8p+15, 3 p2-3p-18, 12 p2-p-30

Standard Deviation The standard deviation is the square root of variance: The built-in function in a MATLAB for the standard deviation is known as std; the standard dev

Strings as matrix: The matrix can be generated, that consists of strings in each row. Therefore, essentially it is created as a column vector of strings, but the final result

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

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