Particle in a Box

Hello everyone,
I'm very new to LabVIEW and programming languages in general. In our class, we have been asked to create a program that describes the motion of a particle in a 2D box. That particle in to be subjected to user selected forces, acceralerations, etc. The problem is, our instructor pretty much everyone for us to do and didn't really explain how to anything. 
For the simple case of a particle moving around in a box, I understant the logic behind it. Just give a particle an initial position. To that initial position, add the displacement that it occurs after time dt, by the linear equation, r(j+1)=r(j)+vdt. Then if the particle reaches the boundrym, reflect the corresponding component of the velocity. Can someone just please explain to me how I would go about putting any of this down?  
I've attached a copy of all that I have. Am i going in  the right direction or am I completely wrong?
Thank you,
Javier
Attachments:
ProjectileMotionIn2DJavier.vi ‏10 KB

Javier,
Welcome to the Forum (and to LabVIEW and to programming).
Thank you for mentioning that this is a class assignment. We will not do your work for you but are glad to help you understand how to use the tools (LabVIEW) to do your assignment.
You have made a good start. The most important part of any program is to design it before you start writing code. You have done part of that by specifying the equation which defines the behavior.  You have apparently made some other implicit assumptions: the use of x and y coordinates for the particle position (implied by the choice of XY graph). You have not allowed for acceleration other than in the +y direction. Does gravity pull up in your universe? By using the loop iteration terminal "i" as dt you have defined dt = 1. This is fine for simulation purposes. If you want to scale to "real world" behavior, you may also need to scale dt.
It is very helpful to document your choices and assumptions. The use of free labels on the block diagram can minimize confusion (as in "Why did I do that?!?!?). A note stating that the two element arrays represent the x and y components of position and velocity at time t = i*dt would assure that someone else did not interpret the data as y and x or r and theta.
Another option is to use complex numbers to represent position, velocity, and acceleration. That provides some conveniences in calculations and plotting but is by no means necessary.
You need two more things to get your VI started. First is completion of the position and velocity feedback. For each iteration of the loop you need to put the updated values into the right sides of the shift registers.  Second is to accumulate a history of the particle positions and velocities (and accelerations?) for plotting purposes.  The graph requires an array.  The most obvious choice is to use Build Array. That works but LV requires that all the elements of an array be stored in contiguous locations in memory. So an array that grows in size requires frequent re-allocations of memory. If the arrays get large, memory fragmententation may result in memory errors long before the arrays become larger than the total available memory. So it is better to Initialize the arrays outside the loop and to use Replace Array Subset inside to update the data in the array.
Lynn

Similar Messages

  • Custom particle problem, transparency not showing in generated particles?

    Using After Effects CS5 and Trapcode Particular:
    I want to use a custom particle for the generated particles.
    So I have imported a .gif image of a pollen grain, which have a transparent backround.
    The transparency does not automagically show after the import, but I have found (via web) that I can
    select the imported gif in After Effects and do the following:
    Effects>Keying>Color Key and then use the eye dropper to key out the color I want to be transparent?
    Then the imported image show transparency where it should (more or less), but the generated particles still show the white background instead of the newly added transparency... how do I make it so the transparency in the imported image, is visible in the generated particles?
    I also probably want to get some better 3D look to the particles, so I'm considering buying a 3D model of a pollen grain.
    What 3D fileformats are supported out of the box to be used with AE and Trapcode Particular and is there something in particular I should
    aware of when buying such files?
     

    how do I make it so the transparency in the imported image, is visible in the generated particles?
    Pre-compose the keyed layer.
    What 3D fileformats are supported out of the box to be used with AE and Trapcode Particular
    There are none. Neither AE nor Particular support 3D geometry.
    Mylenium

  • Sending data through a serial write box (vision processing)

    Hi there, I am fairly new to labview and vision assistant. I was wondering if I could get some assistance on a particular problem we are having with our project. The idea is that we will use a webcamera to analyze a continuous loop of images and identify shapes, then send the data through the serial port to a controller which uses the mint motion language. The problem we are having is we cant sind a way to send the data we are getting from particle analysis to the serial port. Is there any way we can do this? I would be eternally grateful for any kind of pointers!
    I will attach the write to box we are using right now as well as the program itself
    Attachments:
    bild.vi ‏104 KB
    SKRIV2BOX.VI ‏31 KB

    What you are searching for are the functions "Flatten To String" and "Unflatten from String".
    Attachments:
    FlattenToString - UnflattenFromString.vi ‏16 KB

  • Animate Particles Using Image Source Alpha Mask - Outline

    I am trying to animate particles emitted from the outline of an alpha mask. I can get the emitter to see the mask, but only as a rectangular bounding box. How do I get the particles to be emitted from the organic shape within the mask? I created the alpha mask in Motion.

    Heya,
    I see what you're talking about: using the alpha for Fll or Random Fill seems to work fine, but using the alpha with Outline doesn't seem to work (except using the outline of the whole bounding box).
    Maybe a bug, though I would guess that generating an outline path from an alpha channel would be an expensive process, computing-wise. It makes sense if you have a relatively simple alpha with a single "blob" of solidity, but if you had a complex (noisy) alpha, it would be a royal pain to solve.
    Would be nice, though

  • Particle System Collision Area?

    so I've got a bunch of modules called "c4" labled red1,red2,red3, etc. And a laser made from particles, with angle controlled
    by bckspace and enter keys:
    onEnterFrame = function(){
    for (m=1;m<4;m++){
    c4 = this["red"+m];  
    if(robot_mc.laser_mc.lasereye_mc.hitTest(c4.cap)){c4.gotoAndPlay("frame2"); }
        //laser controls
        if(Key.isDown(Key.BACKSPACE)){robot_mc.laser_mc._visible = true; robot_mc.laser_mc.lasereye_mc._rotation -= 7;}
        if(Key.isDown(Key.ENTER)){robot_mc.laser_mc._visible = true; robot_mc.laser_mc.lasereye_mc._rotation += 7;}
        if(!Key.isDown(Key.BACKSPACE) && !Key.isDown(Key.ENTER)){robot_mc.laser_mc._visible = !true;}
    for(i=0;i<500;i++) {
        photons = this["photon"+i];   
        var k:MovieClip = robot_mc.laser_mc.lasereye_mc.attachMovie("photon","photon"+i ,robot_mc.laser_mc.lasereye_mc.getNextHighestDepth());
            k._xscale = Math.random()* 120 - 20;
        k._yscale = Math.random()* 180 + 35;
        k._y -= Math.random()* 10 +10;             //plus changes distance of start of beam, base changes range
            k.gotoAndPlay(Math.ceil(Math.random()*16));    }
    The problem I run into is having the collision work with the beam, as opposed to the bounding box that begins with the
    lasereye_mc. Is there a way to get the c4 to react with the beam, instead of the bounding box around the beam? Or a way to get the photons to interact individually? Also, is there a way to load a particle system through an onEnterFrame without it overloading/oversaturting ?    Thanks.

    ok, so I added the remove movieclip at the end of the particle timeline,
    and then cut down the i<500 to i<80, and added the c4.cap hitTest;
    for(i=0;i<80;i++) {
        photons = this["photon"+i];   
        var k:MovieClip = robot_mc.laser_mc.lasereye_mc.attachMovie("photon","photon"+i ,robot_mc.laser_mc.lasereye_mc.getNextHighestDepth());
            k._xscale = Math.random()* 120 - 20;
        k._yscale = Math.random()* 220 + 35;
        k._y -= Math.random()* 15 + 10;             //plus changes distance of start of beam, base changes range
            k.gotoAndPlay(Math.ceil(Math.random()*16));   
                for (m=1;m<4;m++){
            c4 = this["red"+m];   
        if(c4.cap.hitTest(k)){c4.gotoAndPlay("frame2"); }
                } //end c4 for loop
        } // end photon for loop
    and duplicated the loop for the c4 module. It now works like a charm ^_^
    Thanks much!

  • Can't edit Opacity Map in CC Particle World After Effects CS6

    For some reason I can click the and adjust the Opacity Map in CC Particle World. Normally and I click i nthe box and adjust the curves, but nothings working right now. This has never happened so I dont know if this is a glitch or if I inderectly changed a setting or somtething. Appreciate the help.

    It's a bug. We're working with the Cycore folks to get a fixed version of this plug-in for the next bug-fix update.

  • Problems with line shape for particle emmiter

    This is possibly a multi-faceted problem.
    I have an particle emitter that looks like a stream of blood.
    The problem is: it emits out both sides of a point, using a "line" for
    the emitter shape, and (the lesser problem) it is a straight line.
    -How can I get it to only emit along one side of the line?
    -And is there a way to have particles emit along a curved line?
    Thanks for the help!

    Ok, so the goo emitter is kinda different. I was using a basic emitter that I built myself. After taking a look at the goo emitter, here's what I discovered.
    If you right-click in the emitter box and choose "emitter" from the menu, you'll notice that the Line shape you're using is really small. This can be altered longer if you want by dragging on one of the two control points.
    However, this also helps show you how the emitter is working. Keep the shape in Line for now, but if you drop the scale randomness to 0 and drop the scale to 90 (to make things easier to see), then drop the speed randomness to 0 and raise the speed from 0 to 100, you'll see that the emitter is now just spewing downward. The high speed randomness was pushing the particles up as well as down.
    I found that if you turn the speed up, then you can adjust the randomness to a certain extent before the particles go up again. I'm not sure exactly the effect you're looking for, so you'll have to play with it. But for example, if I had the speed set to 200, then I could apply a randomness value of 360 or so and the particles will still only go down. If I raise that value over 450, the particles start to go up again.
    As far as your geometry problem, it worked for me, but gave me results I wasn't expecting. For one thing, I had to draw the line much smaller than I expected, and the particles were no longer moving down, but rather to the right. The first issue I solved by making the shape smaller. The second problem I solved by adjusting the Emission Angle (not range) to 270 degrees.
    I'm not sure you'll have the same results, but after you draw the shape and drag it into the source well, right-click the emitter in the viewer and choose "emitter" so you can see how the emitter is performing.
    Let me know if you have anymore problems.
    Andy

  • How can I clean stuff that got under the speaker grille?detergent particles

    Well I spilled some laundry detergent near the Macbook Pro, and some of the particles got under the speaker grille. It's mainly a cosmetic problem because everything still works perfectly fine, but I was just wondering if anyone have any suggestions on how I can get all the detergent particles out from under the speaker grille... I tried vaccumming them out, but no luck.
    -Thanks

    Welcome to Apple discussions!
    No ideas, but I would be concerned about it. You might want to read the ingredients list on the detergent box and see what they are. Detergents can contain a variety of caustic chemicals like sodium carbonate. It's humid in Sugarland and the humidity could get to those fine grains and stick them to the I/O board and whatever else is in there. Over time, no telling what it might do to the traces. So there could be trouble on down the road. You might want to consider having the computer opened up and the particles removed by a professional, particularly if you are under warranty. Apple doesn't cover accidental damage, but possibly your homeowner's policy might.
    Good luck!

  • Particle question!

    I'm working on a project where i've created a load of particles (about 30 floating mobile phones) using 3D space, Box mode random tiled with no Speed, 10 seconds life, and the random movement behaviour attached. Now i want to emit another load of particles (little phone call icons) from EACH of the first set of particles from their current positions, but i've got no way of knowing where they are in 3D space. Anybody got any thoughts? I'm finding myself reaching for Trapcode Particular in After Effects as it has an Aux particle system, but you can't use custom particles with the Aux system. Grr..

    could you build the particle emitter for the little phone icons. Put that in a folder with a large phione icon on top of it so it looks like it is emitting the smaller icons. < </div>
    Cool suggestion. I am in awe of your guys who can think in Motion's paradigm.
    In After Effects, without any Trapcode products, I'd have done something similar but the sub-particles would have been created with Foam using a movie source (little icons in different colors-sizes-orientations) and selecting random frames from the movie for each new particle.
    bogiesan

  • Clever particle filter

    Hello,
    I am trying to solve a task, where I need to exclude blobs in binary image based on the blob size,
    the size treshold changes with the blob position.
    Since this is not doable through the standard particle filter, I made mask out of results.
    The algorithm is not fast enough + it keeps bad blobs if the later bounding boxes overlap them.
    Please suggest some other method.
    Bublina
    Solved!
    Go to Solution.

    Hi Bublina!
    Your method is a really good start, I would like to add a few ideas to it. First of all, you can add many objects (rectangles, ovals, points, etc.) to a single ROI descriptor, so it's easier to have all removed objects listed in a single ROI, then you can do the masking all at once. You can also fasten execution by using Particle Analysis.vi, which only performs the measurements selected by you, not all of them.
    Here's some example code of these changes: (sorry for the picture instead of a snippet, my LV is acting up a bit)
    Just replace the code at the red arrow with your decision-making code and it should work.
    As you can see it is still quite a simple filter (it masks bounding rectangles), so if you have strangely shaped particles or your particles are too close together, some useful data might be erased. So if you need a more precise approach you could go by labeling your particles (so assigning a different color to each one), then deleting colors from the image based on criteria you specify.
    I hope this helps.
    Best regards:
    Andrew Valko
    NI Hungary
    Andrew Valko
    National Instruments Hungary

  • Particles of dust under the glass of multi-touch screen

    Dear Sir,
    I bought iPhone 3G in HK yesterday. After I opened the box and activated my iPhone, I have found 2 dark spots on the middle of screen. At first, I thought they are dead pixels. However, after taking a look carefully, I think they are particle of dust under the glass of touch screen. How come? from manufacturer process? because I just open it from the box.
    Is there any warranty from Apple cover this problem?
    What is the method you may help me?
    Change the new machine or fix it?
    Is there anything I can do by myself?

    No sir. There is nothing that you can do your best bet is to bring it back to your provider, or if there is a apple store over there bring it back to them. I know that apple will exchange your unit for this issue. It is from the manufacturer process it seems that they do not have a dust free environment. So just exchange it.

  • Contact form check boxes will not work on a Tablet

    Hi there,
    I created a website (Desktop) and a mobile version (Phone).  I did not create one for a tablet but have relied on the Desktop version if someone views it on a Tablet.
    Here's the thing, I created a contact form with checkboxes.  It works great on a desktop (because people check the boxes with their mouse), however, it doesn't work on a Tablet, when you try and check the boxes with your finger.
    Help!

    Please share the site URL.

  • Expand Text Box? "Advanced" text options not hidden?

    The title text box/editor is very small in the 10.2 update.  It's just big enough for 2 lines of text.  I find it fairly inconvenient to have it so small (I am referring to the text box in the inspector).  I'm guessing there is no way to expand this to fit more lines of text in, but if anyone knows how that'd be sweet! Otherwise I'm just crossing my fingers it gets a quick update since I'm using it every day for work.
    Also, the "advanced" tab always being collapsed in the basic text editing tools is annoying, too.  I use this every time I make a title(which I'm making two videos a day, so it's a little more tedious now after the update).  Personally, for a professional program I would consider the options in the "advanced" section to actually be basic and fairly necessary...based on how I use it, so maybe I'm not a normal case.
    Nothing is broken, just less convenient...
    Thanks y'all!

    That is a wonderful idea if I could find where to do that (maybe another feedback will be to make finding the feedback area easier (: ). Where can I find the feedback area?  Thanks for the quick reply as well!

  • The edit text options box not displaying

    The Font family, size, alignment box does not appear anymore. What happened?

    Hi champsters,
    Is this occurring with a specific pdf?
    What version of Acrobat are you using?
    Have you tried updating it to the latest patch and checked?
    Regards,
    Rave

  • How to get ALL values as default for  a drop down box in JSF

    Hi,
    I have a drop down box in JSF page which retrieves values from LOVCache.java. I have values like Company, Client, User, ALL in the drop down box.
    By default blank value is selected for the drop down box. I want to make ALL(which retrieves data for all the values) as default value for the drop down box.
    Could any body help me? Any help must be appreciated.
    Thanks,
    Aseet

    Thanks Nikhil. But I am fetching the values from the LOVCache.java.
    I am using <af:selectManyChoice>. Is there any way I can use LOVCache.java value for selecting default values instead of hard coding?
    I mean to say can I write
    unselectedLabel="#{LOVCache.entityTypeSelectionList.anyValue}"
    where LOVCache.entityTypeSelectionList is used to populate the drop down box.
    Regards,
    Aseet

Maybe you are looking for

  • Why is KTorrent so much slower?

    Good afternoon, I was using KTorrent for quite a while and the downloads were partly very quick, but partly very lousy, concerning the rates. I once tried to open up the same torrent under µtorrent 1.6.0 (later 1.6.1), using WINE. The rates were part

  • Cannot view PDF created by passing xml and XSL-FO using UTL_HTTP

    Hi, Using UTL_HTTP Iam trying to contact a servlet which uses the input XML and XSL/FO to produce a PDF.However, when I run the procedure , I get the following error 'File does not begin with -%PDF' ? I checked the output on the console and the blob

  • How to change content-type (text/xml;charset=utf-8)  in SOAP receiver?

    Hi, How can I change the content-type (text/xml;charset=utf-8) sent by the SOAP adapter to an external webservice? I need to sent text/xml  as content-type to the webservice, otherwise I get an error. I have tried with different adapter modules but s

  • How do I update my OsX 10.6.8 to the most recent software?

    I am way behind on updating my software.  I have a Macbook that I bouth in 2007.  I just upgraded to Snow Leopard.  I am assuming I need to download Lion and then Mountain Lion?  Will it work on my older Macbook?

  • My own music and iCloud

    I make music and put the tracks straight onto iTunes. Will they transfer to iCloud in the same way or will they not go on? Thanks for any help in advance!