<?php

$g 
12350;
$a = -40;

$a1 = -100;
$a2 0;

$g1 12300;
$g2 12400;

$d1 983.24;
$d2 974.35;

$x1 979.68;
$x2 970.79;

$y1 $d1+(($g-$g1)/($g2-$g1))*($d2-$d1);
$y2 $x1+(($g-$g1)/($g2-$g1))*($x2-$x1);

$y $y1+(($a-$a1)/($a2-$a1))*($y2-$y1);

print 
$y "\n";
Linear Interpolation??? - TranceAddict Forums

TranceAddict Forums

TranceAddict Forums (www.tranceaddict.com/forums)
- Chill Out Room
-- Linear Interpolation???


Posted by Joss Weatherby on Oct-29-2009 21:06:

Read This! Linear Interpolation???

Does linear interpolation work on ballistic trajectories???

I am using this one interpolation algorithm on a 3D data table, and I am getting the wrong results.

Minus the 3D part table, can you use linear interpolation to interpolate angles of elevation for different ranges?

ex:


range elevation
4500 55.6
4600 54.3


I tried but I get results that are slightly off, I am wondering since its not a linear decline between values that my algorithm is wrong...

This is it, including the 3D jump in data... since I need to interpolate two different elevations correlating to altitude for each row relating to range...

PHP:


Posted by shuni on Oct-29-2009 21:28:


Posted by Reza on Oct-29-2009 21:39:

you'll get more answers if you post about:

Rape
Fart
Penis
********


Posted by Krypton on Oct-29-2009 22:05:


Posted by Joss Weatherby on Oct-29-2009 22:36:

Harpoons are sick.

They can lock on and seek out those little swipe pay things at gas stations...

This _has_ happened.


Posted by tachobg on Oct-30-2009 01:33:

are you saying that you have a list of (elevation, range) pairs and you want to calculate elevation E for a given range R that does not appear in the list?

If that's the problem, there should be an equation that relates elevation to range. Can't you just use that? If I misunderstood and it's a more general data fitting problem, then read on.

The problem of discovering the relationship between a bunch of data points is not always trivial. Most of the time, it is not linear either. Say I plotted random points from a sine curve. You wouldn't try to fit a line to those points because they aren't related according to a line. If you do, you'd get the wrong predictions for what the data looks like in general.

The problem of finding the right type of curve to fit (line, parabola, whatever) is called model selection. The family of curves that you consider for fitting the data (say, the family of all parabolas) is called the model. The problem of finding the best particular curve in the chosen model is called estimation.

So, you have to answer two questions - 1) what model is best for relating elevation and range 2) how do i find the best function from this model to fit the data.


Posted by Joss Weatherby on Oct-30-2009 02:09:

Yea, its a table of ranges.

Each row represents a different range in increments of 100 meters, and each column is the elevation it takes to hit that range at different altitude differences, starting at -1000 and going to 1000 in increments of 100.


Posted by tachobg on Oct-30-2009 04:59:

Seems like the most straightforward thing to do is work out the math and come up with a formula relating elevation, altitude and range. Where did the data come from in the first place?


Posted by Joss Weatherby on Oct-30-2009 05:18:

quote:
Originally posted by tachobg
Seems like the most straightforward thing to do is work out the math and come up with a formula relating elevation, altitude and range. Where did the data come from in the first place?


I am generating the data via another algorithm, the reason I have to do it via a ballistics table is that when I try and run this in the game I am using it is too slow, often taking 70 seconds to generate one solution.

I will need to generate at least 8 solutions fairly quickly based off of different initial velocities and whether or not I want to use a high angle or low angle trajectory.


Posted by iTranscendence on Oct-30-2009 06:04:

Triangulation?


Posted by winston on Oct-30-2009 07:44:

ideal projectile motion with different launch angles, you use pythagoras to calculate the angles, you need to compute the trajectory. calculate velocities using kinematics. remember, during ideal projectile motion x and y axis are independent of each other, x axis is constant! therefore, there will only be change in the y direction. its motion will be projected differently along each axis. read up on ideal projectile...to get an idea of where to begin digging for an algorithm that solves your dilemma.

here...to set you off:

displacement at vertical axis.




initial vertical velocity



time - quadratic square root added



Range given projection angle and
equal initial and final elevations

range


Posted by Joss Weatherby on Oct-30-2009 08:43:

I have the trajectory calculations down pat, but they are too slow, taking many thousands of iterations to get the correct angles.

I just need to know what kind of interpolation needs to be done on sampled trajectory data to get more accurate results than I am getting now.

I am getting results that are sometimes 4-5 milliradians in elevation off, which on a low angle trajectory can result in rounds landing almost 150 meters off target.


Posted by colonelcrisp on Oct-30-2009 11:47:

quote:
Originally posted by Joss Weatherby
I have the trajectory calculations down pat, but they are too slow, taking many thousands of iterations to get the correct angles.

I just need to know what kind of interpolation needs to be done on sampled trajectory data to get more accurate results than I am getting now.

I am getting results that are sometimes 4-5 milliradians in elevation off, which on a low angle trajectory can result in rounds landing almost 150 meters off target.



what root finding method are you using to solve the equations?


Posted by Omega_M on Oct-30-2009 16:50:

maybe you can use a higher order interpolation. You can look up an algorithm for some polynomial, like quadratic / cubic or spline interpolation. Or, if you have access to matlab, you can easily generate a polynomial function for your data...if you have the entire data set before hand that is. If not matlab, maybe excel can do it. You will have to check.

Why don't you draw the expected curve and show us what exactly is the issue ? Maybe you can also supply the table of data points that you are using.


Posted by Dervish on Oct-30-2009 17:26:

Basically just split off the amount of pure vertical component of the projectile, see how long it takes gravity to decelerate that to 0, then how long it takes for that to fall from the height it reaches.

Then you have the time, just calculate how far horizontally it would travel in that time (also include any air resistance deceleration).

If it is taking too long, don't actually calculate it, just use look-up tables (if it doesn't have to be uber accurate, and you have plenty space).



Powered by: vBulletin
Copyright © 2000-2021, Jelsoft Enterprises Ltd.