|
From: Ethan A M. <sf...@us...> - 2014-01-30 23:12:53
|
On Thursday, 30 January, 2014 22:23:55 Jon Gjengset wrote: > > > > To use smoothing with a function you need to modify your plot command > > so that the function is treated as sampled data: > > > > plot 'phase.log' using 1:(atan2($3,$2)) w lines ls 1 t 'Wrapped' \ > > ,'phase.log' using 1:(atan2($3,$2)) w lines ls 3 t 'Unwrapped' smooth unwrap \ > > ,'+' using 1:(x-(floor(x/6.28)*6.28)-3.14) ls 4 t 'Wrapped func' \ > > ,'+' using 1:(x-(floor(x/6.28)*6.28)-3.14) ls 5 t 'Unwrapped func' smooth unwrap \ > > s/x/$1/ Hmm. "x" works for me. Unlesss "set parametric" is active, in which case "t" works. But $1 is also correct. > Personally, I think what makes most sense is to not deal with plotting > sampled functions as a special case. Unwrap will work "as advertised", > and users who know what unwrap is supposed to do are likely to > understand what is going on when they zoom/pan. Agreed. I was originally worried that the unwrapping might apply only to the data inside a selected zoom box, in which case it would suffer the same shift of origin as you see for sampled functions. But your code reevaluates the entire set of input data rather than just the currently INRANGE data, so that problem is avoided. > One separate note about the patch is that the line: > > lasty = M_PI; > > should possibly be changed to > > lasty = 0; > > The former makes sense for a signal that usually varies from 0 to 2*pi, > whereas the latter makes more sense for signals that vary from -pi to > pi. In practice it will make little difference beyond the y-intercept of > the unwrapped line. Origin at 0 seems more obvious in the absence of data. I have no idea which convention is more common for real world data sets. Could you write up brief section for the documentation/help file? Ethan |