Illustration of labels and prompts, MATLAB in Mathematics

Assignment Help:

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

 


Related Discussions:- Illustration of labels and prompts

Recursive functions, Recursive Functions: The Recursion occurs wheneve...

Recursive Functions: The Recursion occurs whenever something is defined in terms of itself. In the programming, a recursive function is a function which calls itself. The Recu

Fprintf function - file function, fprintf function - File function: Th...

fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

Plot functions, Plot Functions: Faraway, we have plotted to generate t...

Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to

Use of string variables, Use of string variables: The Characters invol...

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

Common form of the switch statement, Common form of the switch statement: ...

Common form of the switch statement: The common form of the switch statement is as shown below:   switch switch_expression   case caseexp1    action1   case cas

Standard deviation, Standard Deviation The standard deviation is the sq...

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

Writing variables to a file, Writing variables to a File: The save com...

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Complex numbers, Complex numbers: A complex number is commonly written...

Complex numbers: A complex number is commonly written in the form z = a + bi here a is known as the real part of the number z, b be the imaginary part of z, and i is √-1

Example of recursive functions, Example of Recursive functions: This d...

Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Animation, Animation: In this part we will observe a couple of ways to...

Animation: In this part we will observe a couple of ways to animate a plot. These are visuals, therefore the outcomes can't really be shown here; it is essential to type these

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd