Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Modeling Tips & Help post and replies

Return to the Modeling Tips & Help thread
Login to post to this thread

Fixed Function Plotter - Nov 14, 2011 at 3:47PM
Ronald Modesitt
2 Posts

I am following the Fixed Function Plotter example in chapter three of Modeling Science: From Free Fall to Chaos.

My graphs appear correctly, however, the trace function connects the end points of the graph (straight line) for both sin(x)/x and sin(x). What parameter do I change to eliminate this effect?

Many thanks for EJS. What a fun environment to re-learn physics.


Replies to Fixed Function Plotter

Re: Fixed Function Plotter - Nov 14 2011 4:13PM
Francisco Esquembre
222 Posts


When you set arrays as inputs to a Trail, each time the view is updated, a whole new set of points (x[i],y[i]) is added to the trail, connecting them to whatever previous points the trail had.

Because at start time the view is updated a couple of times (to make sure it has the very last state after start-up), you have not 500, but at least 1000 points displayed. The point 500 (the end of the first complete plot) is connected to the point 501 (beginning of the second copy of the plot) and this causes the ugly line you complain about.

You want to set the "Clear at input" property of the trail to "true". This clears any existing data before adding  the (x[i],y[i]) pairs to the trail. This way, you will have exactly 500 points displayed each time.

That should fix the problem.


Re: Re: Fixed Function Plotter - Nov 14 2011 5:03PM
Ronald Modesitt
2 Posts

Thank you for the help. The solution is obvious now that I re-read the help file.


The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics