# NTNUJAVA Virtual Physics LaboratoryEnjoy 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 December 30, 2009, 05:42:18 pm

 Title: Ask : How to draw v(t) with EJS Post by: ahmedelshfie on December 30, 2009, 05:42:18 pm Hello professor this project XML my ask is about graphic of (V) i typing equations Vx,,Vy,,and V but only graic v about time no work so i change i think is mathematics on evolution... so (T)(V) graphic no Right .. thanks for helpwith my respetAhmed Title: Re: Ask Post by: Fu-Kwun Hwang on December 31, 2009, 10:54:14 pm QuoteHello prof thank you for your help the project is motion project v;vx;vy i get equations vx and vy right valecoty, the ramp and grafity only problem about t(time) grfic of time so variables is,, t = 0.0,, y = 0.0,, vy = 0.0,, g = 9.8,,  x = 0.0,,  vx = 0.0,,  v0 = 10,,  theta = 1.57,,,,ok and all type is (double) so i make equation in initialization  vx and vy by this way vx = v0*Math.cos(theta); / vy = v0*Math.sin(theta);and typing in initialization  t = 0;                                    x =0;                                    y =0;                                    g =9.8;ok so all get right about grafic now only the problem is i wanna get grafic of time and for me get grfaic time on plot that mean i use (V) sov = math.sqrt(vx*vx)+(vy*vy-g*t); i typing by way of easy java becouse i try typing equation by mathtype and paste for you but no accept  so prossor i hope u can help´me how i get (V) on program and grfic t (time) for (V)thank you profssor for you helpwith all my respectahmedThe above message is what I received in my private message box.The following is my response to your question.Code:t = 0.100;x = 0;y = 0;g =9.8;vx = v0*Math.cos(theta);vy = v0*Math.sin(theta)-g*t;The above is what you wrote in initialize page. Normally, what I will do isCode:t=0.s;x=0;y=0;g=-9.8;vx=v0*Math.cos(theta);vy=v0*Math.sin(theta);because you already set up correct evolution relations:dx/dt=vxdy/dt=vy;dvy/dt=-g;when simulation is playing, it will calculate x(t),y(t),vy(t) according to the above equations.There are three trace in your plottingPanel:Code:The name:  Input X and Input Y are1. plot : x,y2. plot2: x,vy3. plot2: vx,tIf I want to show trace vary as function as time t, the Input X property should be all time t.If you want to show v=Math.sqrt(vx*vx+vy*vy) as function of time you can assign Input X as t, and assign Inoput Y as Math.sqrt(vx*vx+vy*vy).If you assign Input X as t, and Input Y as vy, you will find a stralight line because vy=vy(t=0)-g*t; Title: Ask/board:29-100- Post by: ahmedelshfie on January 04, 2010, 04:47:00 pm Hello profssor this Xml file i post topic befor about this project like you ask me im try get ghrapic of (V) i think the problem in evolution im wait your answer profssor with all my respect Ahmed Title: hi Post by: ahmedelshfie on January 04, 2010, 07:09:09 pm Hello prof i find word file i send you as jpg for you see graphics of velocity with time (V)(T)thanks so much Ahmed Title: Re: hi Post by: lookang on January 04, 2010, 09:18:11 pm u want to plot vx , vy and |v| ?U may want to look into the source xml herehttp://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=745.0 Title: Re: How to draw v(t) with EJS (modified EJS xml file) Post by: Fu-Kwun Hwang on January 05, 2010, 11:25:25 pm Quote from: ahmedelshfie on January 04, 2010, 07:09:09 pmHello prof i find word file i send you as jpg for you see graphics of velocity with time (V)(T)thanks so much AhmedYou should move Code:if (y< 0) _pause();to Fixed relations tab.You do not need $\frac{dv}{dt}=g*t-vy$. $\frac{dvy}{dt}=-g$ will calculate $vy(t)=vy(t=0)-gt$ for youI have modified your ejs xml source.Please check out the attached file.