Illustration of plot function, C/C++ Programming

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.

Posted Date: 10/18/2012 6:52:31 AM | Location : United States







Related Discussions:- Illustration of plot function, Assignment Help, Ask Question on Illustration of plot function, Get Answer, Expert's Help, Illustration of plot function Discussions

Write discussion on Illustration of plot function
Your posts are moderated
Related Questions
write c++programm that converts degrees Kelvin (TK) to degrees Fahrenheit(TR) recall that TF=(9/5)TK and that TF=TR-459.67

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

write a c program to find input string using strlen(), strcpy(), strcat(),strncat(), strcmp().


one of the segments is showing compilation error...

Poker Room auto seat program Project Description: I want a script for an online poker site. It requires to be scanning all the available tables and when the table meets certa

Bit-wise Operators Some applications require operations to be done on dissimilar bits of a byte separately. Bit-wise operators offer a facility to do just that. There are vario

Want a scraping program created Project Description: We need to hire a professional developer to scrape the site for information such as *product title *Product Price

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

(a) Write a procedure called (add x y) that adds two numbers in a recursive manner. Specifically, note that x + y = (x + 1) + (y - 1) and x + 0 = x. (b) Using the substitution m