Help plotting a graph using a variable

To start off , i am dealing with robotic project.

I have this speed variable (lets call it 'x').
This 'x' variable will update itself every xx ms as it is using the PID formula to compute.

http://en.wikipedia.org/wiki/PID_controller

As the variable is constantly increasing or decreasing , is there such a way that i can write the program to plot the graph of this 'x' variable against time(ms).

The main purpose is for me to plot a graph so that i can observe the acceleration and deceleration of the robot so that I can tune the PID.

Thank you.
If you have a collection (in the form of an array or an STL container) of coordinates (time, speed) then simply use that information to output a graph on screen. It will be no different from graphing any other pair of coordinates and I bet you can find examples on the Net. But even if you find nothing specific for C++, you can read about graphing or charting for other languages because the algorithm will be similar.

For example, you need to calculate the proper scale to use, decide whether or not your graph will auto-scale depending on the data (highly recommended), and how to actually draw the curve, which in reality is quite simple: Connect the coordinates with line segments.
I'm not sure about plotting in C++, but if you don't have to use C++, maybe you can try some less 'strict' language for the plotting part. For Python, as an example, using the package 'matplotlib' will make it really easy. The data transfer can be a little tricky, but you can always transfer with data files.
So far in school i had only learned basic c++ and object oriented programming.

From all the information i gathered so far , my methodology of doing is like this.

Since the speed variable is constantly changing , i am going to "dump" the data using sql or using iostream ( into a .txt file )

Next I gonna find c++ graph api open source , using the database that i got , feed in the information to the function of the api file.


Anyway I never did this before , i hope it turn out alright.
Topic archived. No new replies allowed.