Hello Sorry, I can't find the starting point for a solution to produce a plot where the y value dependence from the line before and behind the current line in a data set. What I want to do is the following. If y(n-1) < y(n) and y(n+1) < y(n) than y = y+a If y(n-1) > y(n) and y(n+1) > y(n) than y = y-a else y = y Where n is the number of the line in a data set. "a" is a variable. The y value is in a column of a data set. And this in a plot command, so that the y value dependence from the y value in the line before and after the current line in a data set. Can somebody gives a kick-off to me? I think/hope that I really need only a starting point for this problem. Jörg

0 |

11/28/2016 7:27:27 PM

Am 28.11.2016 um 20:27 schrieb Jörg Buchholz: > Hello > > Sorry, I can't find the starting point for a solution to produce a plot > where the y value dependence from the line before and behind the current > line in a data set. > > What I want to do is the following. > > If y(n-1) < y(n) and y(n+1) < y(n) than y = y+a > If y(n-1) > y(n) and y(n+1) > y(n) than y = y-a > else y = y > > Where n is the number of the line in a data set. "a" is a variable. The > y value is in a column of a data set. > > And this in a plot command, so that the y value dependence from the y > value in the line before and after the current line in a data set. You cannot read ahead of the current line, so you'll have to store the last two values (resp. xy value pairs), and always only plot the next-to-last one. Key tool for this ghastly hack is the serial evaluation operator ",". plot dataf us (lllx=llx,llx=lx,lx=$1,llly=lly,lly=ly,ly=$2, llx): \ ((llly<lly && ly<lly) ? lly+a:(llly>lly)&&(ly>llyy) ? lly-a : lly) Haven't tried now. You need to initialise all l* variables with NaN. Honestly, I wouldn't go for gnuplot to do that. Use your favourite spreadsheet calculator to transform the original dataset. Karl

0 |

11/28/2016 8:58:10 PM

On 28.11.2016 21:58, Karl Ratzsch wrote: > Am 28.11.2016 um 20:27 schrieb Jörg Buchholz: >> Hello >> >> Sorry, I can't find the starting point for a solution to produce a plot >> where the y value dependence from the line before and behind the current >> line in a data set. >> >> What I want to do is the following. >> >> If y(n-1) < y(n) and y(n+1) < y(n) than y = y+a >> If y(n-1) > y(n) and y(n+1) > y(n) than y = y-a >> else y = y >> >> Where n is the number of the line in a data set. "a" is a variable. The >> y value is in a column of a data set. >> >> And this in a plot command, so that the y value dependence from the y >> value in the line before and after the current line in a data set. > > You cannot read ahead of the current line, so you'll have to store > the last two values (resp. xy value pairs), and always only plot the > next-to-last one. > > Key tool for this ghastly hack is the serial evaluation operator ",". > > plot dataf us (lllx=llx,llx=lx,lx=$1,llly=lly,lly=ly,ly=$2, llx): \ > ((llly<lly && ly<lly) ? lly+a:(llly>lly)&&(ly>llyy) ? lly-a : lly) > > Haven't tried now. You need to initialise all l* variables with NaN. > Honestly, I wouldn't go for gnuplot to do that. Use your favourite > spreadsheet calculator to transform the original dataset. Thanks, I have fear this. I always have the data before in a spreadsheet, so I will do it there. Jörg

0 |

11/29/2016 6:31:48 AM