NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Information about this web site => Question related to Physics or physics related simulation => Topic started by: ahmedelshfie on January 20, 2010, 07:51:26 pm



Title: Ask about graphic layout
Post by: ahmedelshfie on January 20, 2010, 07:51:26 pm
Hello prof i had problem with project pls help
Is about layout graphic between velocity and time
I try all time make layout graphic get right
But i don't know how pls so i will send attach
For project XML and picture jpg i mark by black line
what i want make in graphic layout
Respect
waiting answer  pls
Ahmed
 


Title: Re: Ask about graphic layout
Post by: Fu-Kwun Hwang on January 20, 2010, 10:19:56 pm
You should have moved the following code to initialization page instead of "fixed relation" page.
Code:
vx = v0*Math.cos(theta);

vy = v0*Math.sin(theta)-g*t;

1. EJS first process "variables" page to allocate memory for variables and set initial value according to your definition.
2. EJS then do commands in "Initialize" page.
3. EJS modified variables in "Evolution" page
4. EJS process commands in "Fixed relations" page.

Then it go to step 3 , and it become a loop when simulation is in play mode.

All the variables need to be initialized before evolution page. So you should put
Code:
vx = v0*Math.cos(theta);

vy = v0*Math.sin(theta); // -g*t is removed because it is correspond to t=0
in initialize page.

If you put the above two line in "fixed relation" page, then vx and vy values will never be changed.

The relation "d(vy)/dt=-g" in evolution page will calculate vy(t)=vy(0)-g*t automatically at each time step.

Two more traces are added in the view.

The modified page is attached.