Hi,
I'm new to this forum. I have a question related to gnuplot which I would
appreciate help with.
I'm trying to generate dummy data. This dummy data is in the form of data
points lying on a straight line, but with "noise" i.e the points are
randomly lying on either side on the original line so that when I plot it,
there are many spikes and dips. This is to represent a "noisy" sensor
reading.
So far, I generated the original line using parametric plots like
set parametric
x(t) = a + b*(t)
y(t) = c + d*(t)
plot [0:2*pi] x(t), y(t)
[please excuse any syntax error since I'm reproducing the code offhand ]
where a,b,c,d were calculated from the two points x1,y1 and x2,y2 the line
is connecting.
I then try to generate some random points using x(t) and y(t) above so that
the points somewhat represent the original line
set parametric
x2(t) = a + b*(t) * rand(0)
y2(t) = c + d*(t) * rand(0)
plot [0:2*pi] x2(t), y2(t)
No matter what configuration of rand() I try, the random points generated
either just form another perfect line , or the points are just concentrated
near one end of the original line. I would like something like this plot:
http://research.stlouisfed.org/fred2/graph/fredgraph.png?graph_id=82216
where the red line is the original line and the blue line the "noisy"
values.
Would appreciate if someone could help me out.
Thanks.
|