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







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
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

#include stdio.h> #include conio.h> #include string.h>   void main() {           char a[50],b[25][25],l[25],temp1;           int i=0,j=0,k=0,l1[25],c=0,c1=0,t=

1. The main program must be in a file called A4.cpp 2. The data must be read in from a data file.  The user must enter the filename.  A sample data file will be provided on Mood

1. The management of a company would like to determine the median annual salary of its employees.Write a pascal program that display the number of employees and their median salary

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

Write two different arrays. Store the names in it and then compare if both the names entered by the user are the same.

What is the difference between structure and class? - Members of structures are public while those of a class are private. - Classes provide data hiding while structures don

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

write a program to find the area under the curve y=f(x) between x=a & x=b

Define the Modulo Division Operator in c language? The C provides one more arithmetic operator % called as modulo division operator and this operator yields the remainder of an