Illustration of plot function, C/C++ Programming

Assignment Help:

Illustration of Plot function:

To be more common, the script could prompt the user for the time and temperature, instead of just assigning the values. Then, the axis function could be used depending on whatever the values of x and y is, for illustration,

axis([x-2 x+2 y-10 y+10])

In order to plot more than one point, x and y vectors are formed to store the values of the (x,y) points. For illustration, to plot the points

(1,1)

(2,5)

(3,3)

(4,9)

(5,11)

(6,8)

At first an x vector is formed which has the x values (as they range from 1 to 6 in steps of 1, the colon operator can also be used) and then a y vector is formed with the y values. This will generate (in the Command Window) x and y vectors and then plot them as shown in figure:

2402_Illustration of Plot function.png

 

>> x = 1:6;

>> y = [1 5 3 9 11 8];

>> plot(x,y)

Note that the points are plotted with straight lines drawn in between. The axes are also set up according to the data; for illustration, the x values ranges from 1 to 6 and the y values from 1 to 11, and hence, that is how the axes are set up.

Also, note that in this situation the x values are the indices of the y vector (the y vector has 6 values in it, therefore the indices iterate from 1 to 6). Whenever this is the situation, it is not essential to generate the x vector. For illustration,

>> plot(y)

will plot exactly the similar figure without using an x vector.


Related Discussions:- Illustration of plot function

Define commonly used built-in library functions, Define Commonly Used Built...

Define Commonly Used Built-in Library Functions? Comprise opened a file pointer you will desire to use it for either input or output. The C language supplies a set of functions

What is default argument, Default argument: When the argument is missin...

Default argument: When the argument is missing then the function will read the default value of the missing argument.  To make use of default argument functionality the argu

C program for removing char which u want, C Program for REMOVING CHAR WHICH...

C Program for REMOVING CHAR WHICH U WANT void main() {           int i,j;           char a[100],r;           clrscr();           for(i=0;i

Give example of the do while loop, Normal 0 false false fal...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Rules of inheritance, Rules of Inheritance: Private members are not...

Rules of Inheritance: Private members are not inherited; the members can be accessed only within its class. It cannot be used through the object. Protected members are

Stone game, how to write a c program for stone game

how to write a c program for stone game

Structures, how to define the structures

how to define the structures

In binary mode how can i open a stream?, A: Use std::ios::binary. Some o...

A: Use std::ios::binary. Some operating systems differentiate among text and binary modes. In text mode, end-of-line sequences and perhaps other things are translated; in binary

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