Thanks, that did the trick. though it would be something like this.
Chris
On 2014/08/25 11:57 AM, Marek W. Gutowski wrote:
> > From: GOO Creations
> > To: gnu...@li...
> > Cc:
> > Date: 2014/8/25, Mon 16:07
> > Subject: [Gnuplot-info] Step function not starting at absolute 0
> >
> > Hi all,
> >
> > I'm trying to create a simple step function. I have this weird
> problem that
> > the x-values of my function do not start at absolute 0, therefore
> creating a
> > skew function. Here is my code:
> >
> > /set xzeroaxis lc "black"//
> > //set yzeroaxis lc "black"//
> > //set terminal pdf//
> > //set output "step.pdf"//
> > //f(x)= x <= 0 ? -1 : 1//
> > //plot f(x) lw 2 lc "black"//
> > /
> >
> >
> > I've also attached the output PDF. As you can see the middle part of
> the
> > function is not parrallel with the y-axis. Does anyone know what I'm
> missing
> >
> > Chris
>
> This is not strange because the sampling points in x axis is a finite
> number.
> (default 100).
> Increasing sample number like "set sample 1000", the appearance will
> be better but
> that is the results mere approximation will be better.
>
> Tatsuro
>
>
>
> Here are my "two cents":
>
> 1. Original function has a jump at x=0. Formally, nothing like vertical
> line should be drawn at x=0. The reason for "incorrect" drawing
> has been already pointed by Tatsuro.
>
> 2. Correct solution is to define TWO functions:
> f(x) = x<=0.0?-1.0:1/0
> g(x)=x>0.0?1.0:1/0
>
> and plot them both, say
> plot [*:*][-1.1:1.1] f(x) lw 2 lc "black", g(x) lw 2 lc "black"
>
> Now you have a plot which is indeed correct.
>
> Cheers,
> Marek Gutowski
|