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

Array, how to do an array

how to do an array

Hwid spoofer for windows 7, HWID Spoofer for Windows 7, 8 x64 Project De...

HWID Spoofer for Windows 7, 8 x64 Project Description: I want a simple program that will spoof my hardware id. I should be able to prepare the id to spoof to in the program a

Simple object-oriented program, This assignment is to be undertaken individ...

This assignment is to be undertaken individually - no group work is permitted. Background information This assignment is an exercise in simple object-oriented programming and, acco

Define inline functions, Inline Functions Imagine a c program, which re...

Inline Functions Imagine a c program, which reads disk records having employee information. If this is a payroll application each employee record data is probably processed by

Calculate the discharge by c program, #include stdio.h #include math.h ...

#include stdio.h #include math.h float discharge(float,float); void main()   {   char prompt;      float time,out,cr;   cr = 100e-6;   for (time = 0;time   {   /* call th

Luminous Jewels - The Polishing Game, First line starts with T, number of t...

First line starts with T, number of test cases. Each test case T contains a necklace (N).

Described smart pointer?, A: A smart pointer is a C++ class which mimics a ...

A: A smart pointer is a C++ class which mimics a regular pointer in syntax and some semantics, however it does more. Since smart pointers to distinct types of objects tend to have

C++, write a c++ program for minimum shelf downloads

write a c++ program for minimum shelf downloads

Virtual constructor, Is it possible to have Virtual Constructor? If yes, ho...

Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible?

Named what can derived class add?, New data members  New member function...

New data members  New member functions  New constructors and destructor  New friends

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