Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

2d linear Interpolation

2d linear Interpolation

2005-03-11 by Rolf Bredemeier

Hi,

i'm searching for an example for 2d linear interpolation.
The data is in an array unsigned char [10][400].

Here is my "worksheet", may be, it help's to explain for i looking on:
http://www.nur-solutions.de/tmp/2dinterpol.gif

There is the way to solve  the prob. for x-value 55 and y-value 800 = 59,35

I need no floting point, unsigned char is only what i need.

Best regards, Rolf

RE: [lpc2000] 2d linear Interpolation

2005-03-11 by Paul Curtis

Rolf,

...but this is a classic problem, such as interpolation of ECU mapping
parameters like engine speed against manifold pressure.  It's only a
very simple piece of maths, what is the problem?  From what I see on the
GIF, the calculations are all laid out for you.  Hence, I conclude it's
a homework assignment and you'll never get anywhere if others do your
homework.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
Show quoted textHide quoted text
> -----Original Message-----
> From: Rolf Bredemeier [mailto:rolf_tt@...] 
> Sent: 11 March 2005 06:42
> To: lpc2000@yahoogroups.com
> Subject: [lpc2000] 2d linear Interpolation
> 
> 
> Hi,
> 
> i'm searching for an example for 2d linear interpolation.
> The data is in an array unsigned char [10][400].
> 
> Here is my "worksheet", may be, it help's to explain for i looking on:
> http://www.nur-solutions.de/tmp/2dinterpol.gif
> 
> There is the way to solve  the prob. for x-value 55 and 
> y-value 800 = 59,35
> 
> I need no floting point, unsigned char is only what i need.
> 
> Best regards, Rolf
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
>

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Kerem Or

Hi,

You may want to try TableCurve 2D if you want to generate a polynomial 
(y=f(x)) to calculate y values against x values. Trial version should be 
available at their web site

Kerem

----- Original Message ----- 
Show quoted textHide quoted text
From: "Rolf Bredemeier" <rolf_tt@...>
To: <lpc2000@yahoogroups.com>
Sent: Friday, March 11, 2005 8:42 AM
Subject: [lpc2000] 2d linear Interpolation


>
> Hi,
>
> i'm searching for an example for 2d linear interpolation.
> The data is in an array unsigned char [10][400].
>
> Here is my "worksheet", may be, it help's to explain for i looking on:
> http://www.nur-solutions.de/tmp/2dinterpol.gif
>
> There is the way to solve  the prob. for x-value 55 and y-value 800 = 
> 59,35
>
> I need no floting point, unsigned char is only what i need.
>
> Best regards, Rolf
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Onestone

Somebody's doing fuel maps from the look of this, however fuel maps just 
aren't linear the way yours are. You may as well just set the start 
point and the end point thus:-
             0      3500
0         12      61
20       17      52
40       18      151
60       23      198
80       44      121
100     56       140

Then for example2300(rpm?) at 55kPa can easily be converted as follows:-

for 40kpa, 2300rpm point:

F1 = (151-18) * 2300/3500. Of course you would precalculate most of this 
so:-
F1 =  133/3500 * 2300. It makes sense to precalulate the increment /rpm, 
ie 133/3500
F1 =  0.038. In 0:16 (unsigned decimal format) this is equal to 0x09BA 
(2490)
F1 = 09BA * 2300 =  0x57.6318 (.038 * 2300 = 87.4)

Now repeast this for the second 60(kPa) row where rpm factor = 175/3500 
= 0.05 = 3277 or 0x0CCD
hence F2 =  0x0073.01CC (0.05 * 2300 = 115)

Now to interpolate the kpa part do (F2-F1)/(60-40)*(55-40)

Again you could speed this up by pre-storing the 60-40 or divide by 20 
as a binary decimal. Which happens to be 0.05 or 0x0CCD in 0:16 format so:-

F2 - F1 =  * 15 =  0x001B.9EB4 * 15 (this orders maintains lowest 
calculation error)  = 0x019E.4C8C

Now divide by 20 or multiply by 0x0.0CCD = 0x0014.B759DC1C => 20.716.

Finally add the 40kPa 2300 rpm value to this, keeping track of the DP = 
0x006C.1A71DC1C. returning to the land of 32 bits this is equivalent to 
108.103. Honestly a LOT simpler than it looks. With your tables having a 
hump you would only need to track the sign of results, which is possibly 
simpler than tracking signed arithmetic. Anyhow it comes down very simply:_

For each kPa point store the difference between 0RPM value and 3500RPM 
value divided by 3500 as a binary decimal.
This gives you 6 values in your scenario, call them K0 - K5, call the 
pressures at these values P'0 - P'5

read RPM (R), read kPa (P)(obviously if I have guessed wrongly 
substitute whatever the axes represent)
if P exactly matches one of the stored values Kn simply multiply RPM by 
Kn else
multply R * K(P'n<P) = Ix
multiply R * K(P'm>P) = Iy

next calculate  Ix + (Iy - Ix) * (P-P'n)/(P'm-P'n)

Might look a bit long winded, but by prestoring a lot of the calculable 
values you can run the calcualtions very fast.

Al




Rolf Bredemeier wrote:
Show quoted textHide quoted text
> Hi,
>
> i'm searching for an example for 2d linear interpolation.
> The data is in an array unsigned char [10][400].
>
> Here is my "worksheet", may be, it help's to explain for i looking on:
> http://www.nur-solutions.de/tmp/2dinterpol.gif
>
> There is the way to solve  the prob. for x-value 55 and y-value 800 = 
> 59,35
>
> I need no floting point, unsigned char is only what i need.
>
> Best regards, Rolf
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=129f2ditf/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110610019/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Groups Links
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Rolf Bredemeier

Hi Paul,

thanks for reply.
Show quoted textHide quoted text
----- Original Message ----- 
From: Paul Curtis 
To: lpc2000@yahoogroups.com 
Sent: Friday, March 11, 2005 1:05 PM
Subject: RE: [lpc2000] 2d linear Interpolation

> Rolf,

> ...but this is a classic problem, such as interpolation of ECU mapping
> parameters like engine speed against manifold pressure.  It's only a
> very simple piece of maths, what is the problem?  From what I see on the
> GIF, the calculations are all laid out for you.  Hence, I conclude it's
> a homework assignment and you'll never get anywhere if others do your
> homework.

Yes, you are right. It is simple for me with paper and pencil. But is much harder,
to code it to C. I just started with C. Is it so awfully, to ask for prepared source?
I am not a lazy bone, the most of my free time is going in self study for electronic
and programing. Excuse me, if my question had made you angry. 
This was not my goal. Please dont take offence for me. And excuse my english,
it is self-learned, too. ;-)

Best regards, Rolf

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Rolf Bredemeier

Hi Kerem,
Show quoted textHide quoted text
----- Original Message ----- 
From: Kerem Or 
To: lpc2000@yahoogroups.com 
Sent: Friday, March 11, 2005 4:17 PM
Subject: Re: [lpc2000] 2d linear Interpolation

> You may want to try TableCurve 2D if you want to generate a polynomial 
> (y=f(x)) to calculate y values against x values. Trial version should be 
> available at their web site

Thnks for the tip. I will look for it.

Best regards, Rolf

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Marko Pavlin (home)

There's no easy way to interpolate non-orthogonal data. You must first 
orthogonate it, at leas in one axis. Then use simple PWL method. I am 
using same procedure for calculating temperature compensation of 
pressure sensors.

Here's simple 2D aproximation algorithm (in matlab). Check SPAPS 
documentation for more details.

function [coefs,fn,err,breakx,breaky]=bivsp(x,y,z,dx,dy,kx,ky)
sp = spap2({kx,ky},[dx dy],{x,y},z);
pp = fn2fm(sp,'pp');
coefs =fnbrk(pp,'coefs');
breaks =fnbrk(pp,'breaks');
l =fnbrk(pp,'l');
k =fnbrk(pp,'order');
d =fnbrk(pp,'dim');
breakx =breaks{:,1};
breaky =breaks{:,2};
err=norm(z-spval(sp,{x,y}))^2;
m = length(breaks);
breaksx=breaks{:,1};
breaksy=breaks{:,2};
v = coefs;
sizev = [d,l.*k];
dd = prod(sizev(1:m));
v=reshape(v,dd*l(m),k(m));
for i=1:1:l(m) %scan all number of x segments
  sizesegx=k(1)*l(1);
  a(:,:,i)=v((i-1)*sizesegx+1:(i-1)*sizesegx+sizesegx,:);
end
v=[];
for i=1:1:l(m) %scan all number of x segments
  for p=1:1:l(1)
    for j=1:1:k(1) %scan all number of y segments
      u(j,:,i,p)=a((j-1)*l(1)+p,:,i);
    end
    v=[v;reshape(fliplr( flipud(u(:,:,i,p)))',k(1)*k(m),1)'];
  end
end
fn=v;



I hope that helps.

Onestone wrote:
Show quoted textHide quoted text
> Somebody's doing fuel maps from the look of this, however fuel maps just
> aren't linear the way yours are. You may as well just set the start
> point and the end point thus:-
>              0      3500
> 0         12      61
> 20       17      52
> 40       18      151
> 60       23      198
> 80       44      121
> 100     56       140
>
> Then for example2300(rpm?) at 55kPa can easily be converted as follows:-
>
> for 40kpa, 2300rpm point:
>
> F1 = (151-18) * 2300/3500. Of course you would precalculate most of this
> so:-
> F1 =  133/3500 * 2300. It makes sense to precalulate the increment /rpm,
> ie 133/3500
> F1 =  0.038. In 0:16 (unsigned decimal format) this is equal to 0x09BA
> (2490)
> F1 = 09BA * 2300 =  0x57.6318 (.038 * 2300 = 87.4)
>
> Now repeast this for the second 60(kPa) row where rpm factor = 175/3500
> = 0.05 = 3277 or 0x0CCD
> hence F2 =  0x0073.01CC (0.05 * 2300 = 115)
>
> Now to interpolate the kpa part do (F2-F1)/(60-40)*(55-40)
>
> Again you could speed this up by pre-storing the 60-40 or divide by 20
> as a binary decimal. Which happens to be 0.05 or 0x0CCD in 0:16 format 
> so:-
>
> F2 - F1 =  * 15 =  0x001B.9EB4 * 15 (this orders maintains lowest
> calculation error)  = 0x019E.4C8C
>
> Now divide by 20 or multiply by 0x0.0CCD = 0x0014.B759DC1C => 20.716.
>
> Finally add the 40kPa 2300 rpm value to this, keeping track of the DP =
> 0x006C.1A71DC1C. returning to the land of 32 bits this is equivalent to
> 108.103. Honestly a LOT simpler than it looks. With your tables having a
> hump you would only need to track the sign of results, which is possibly
> simpler than tracking signed arithmetic. Anyhow it comes down very 
> simply:_
>
> For each kPa point store the difference between 0RPM value and 3500RPM
> value divided by 3500 as a binary decimal.
> This gives you 6 values in your scenario, call them K0 - K5, call the
> pressures at these values P'0 - P'5
>
> read RPM (R), read kPa (P)(obviously if I have guessed wrongly
> substitute whatever the axes represent)
> if P exactly matches one of the stored values Kn simply multiply RPM by
> Kn else
> multply R * K(P'n<P) = Ix
> multiply R * K(P'm>P) = Iy
>
> next calculate  Ix + (Iy - Ix) * (P-P'n)/(P'm-P'n)
>
> Might look a bit long winded, but by prestoring a lot of the calculable
> values you can run the calcualtions very fast.
>
> Al
>
>
>
>
> Rolf Bredemeier wrote:
>
> > Hi,
> >
> > i'm searching for an example for 2d linear interpolation.
> > The data is in an array unsigned char [10][400].
> >
> > Here is my "worksheet", may be, it help's to explain for i looking on:
> > http://www.nur-solutions.de/tmp/2dinterpol.gif
> >
> > There is the way to solve  the prob. for x-value 55 and y-value 800 =
> > 59,35
> >
> > I need no floting point, unsigned char is only what i need.
> >
> > Best regards, Rolf
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> > 
> <http://us.ard.yahoo.com/SIG=129f2ditf/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110610019/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
> >
> >
> >
> > ------------------------------------------------------------------------
> > Yahoo! Groups Links
> >
> >     * To visit your group on the web, go to:
> >       http://groups.yahoo.com/group/lpc2000/
> >       
> >     * To unsubscribe from this group, send an email to:
> >       lpc2000-unsubscribe@yahoogroups.com
> >       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >       
> >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >       Service <http://docs.yahoo.com/info/terms/>.
> >
> >
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here 
> <http://us.ard.yahoo.com/SIG=129hbc9up/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110648344/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
>
>
> *Yahoo! Groups Links*
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Rolf Bredemeier

Hi Al!
Show quoted textHide quoted text
----- Original Message ----- 
From: Onestone 
To: lpc2000@yahoogroups.com 
Sent: Friday, March 11, 2005 6:25 PM
Subject: Re: [lpc2000] 2d linear Interpolation


> Somebody's doing fuel maps from the look of this, however fuel maps just 
> aren't linear the way yours are. You may as well just set the start 
> point and the end point thus:-
> [...]

Many, many thanks to you for thel lot of time you spend to me!
I think, this hints will bring our drag bike to the top ten! ;-)
if you like, you may take a look on it:
 http://www.markvanderkwaak.com/events/2003/drachten3/dr3_060.jpg
(I am the boy in the middle)

The motronic was made with an AVR, but realy not perfect. For my ugly programing,
the AVR had not enough power, to manage things like logging and telemetrie.
And the fuel cal was very bad, only one large table with 1d interpolation for
pressure. But, regardless of everything, it runs!

Excuse me for the of-topic stuff.

Best regard and many, many thanks again, Rolf

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Onestone

Wow!. From the OP's post and example he's simply looking to linearly 
interpolate between the 4 points in his table that bound the measured 
data. A simple task. this is really complicating the issue as presented.

Al

Marko Pavlin (home) wrote:
Show quoted textHide quoted text
> There's no easy way to interpolate non-orthogonal data. You must first
> orthogonate it, at leas in one axis. Then use simple PWL method. I am
> using same procedure for calculating temperature compensation of
> pressure sensors.
>
> Here's simple 2D aproximation algorithm (in matlab). Check SPAPS
> documentation for more details.
>
> function [coefs,fn,err,breakx,breaky]=bivsp(x,y,z,dx,dy,kx,ky)
> sp = spap2({kx,ky},[dx dy],{x,y},z);
> pp = fn2fm(sp,'pp');
> coefs =fnbrk(pp,'coefs');
> breaks =fnbrk(pp,'breaks');
> l =fnbrk(pp,'l');
> k =fnbrk(pp,'order');
> d =fnbrk(pp,'dim');
> breakx =breaks{:,1};
> breaky =breaks{:,2};
> err=norm(z-spval(sp,{x,y}))^2;
> m = length(breaks);
> breaksx=breaks{:,1};
> breaksy=breaks{:,2};
> v = coefs;
> sizev = [d,l.*k];
> dd = prod(sizev(1:m));
> v=reshape(v,dd*l(m),k(m));
> for i=1:1:l(m) %scan all number of x segments
>   sizesegx=k(1)*l(1);
>   a(:,:,i)=v((i-1)*sizesegx+1:(i-1)*sizesegx+sizesegx,:);
> end
> v=[];
> for i=1:1:l(m) %scan all number of x segments
>   for p=1:1:l(1)
>     for j=1:1:k(1) %scan all number of y segments
>       u(j,:,i,p)=a((j-1)*l(1)+p,:,i);
>     end
>     v=[v;reshape(fliplr( flipud(u(:,:,i,p)))',k(1)*k(m),1)'];
>   end
> end
> fn=v;
>
>
>
> I hope that helps.
>
> Onestone wrote:
>
> > Somebody's doing fuel maps from the look of this, however fuel maps just
> > aren't linear the way yours are. You may as well just set the start
> > point and the end point thus:-
> >              0      3500
> > 0         12      61
> > 20       17      52
> > 40       18      151
> > 60       23      198
> > 80       44      121
> > 100     56       140
> >
> > Then for example2300(rpm?) at 55kPa can easily be converted as follows:-
> >
> > for 40kpa, 2300rpm point:
> >
> > F1 = (151-18) * 2300/3500. Of course you would precalculate most of this
> > so:-
> > F1 =  133/3500 * 2300. It makes sense to precalulate the increment /rpm,
> > ie 133/3500
> > F1 =  0.038. In 0:16 (unsigned decimal format) this is equal to 0x09BA
> > (2490)
> > F1 = 09BA * 2300 =  0x57.6318 (.038 * 2300 = 87.4)
> >
> > Now repeast this for the second 60(kPa) row where rpm factor = 175/3500
> > = 0.05 = 3277 or 0x0CCD
> > hence F2 =  0x0073.01CC (0.05 * 2300 = 115)
> >
> > Now to interpolate the kpa part do (F2-F1)/(60-40)*(55-40)
> >
> > Again you could speed this up by pre-storing the 60-40 or divide by 20
> > as a binary decimal. Which happens to be 0.05 or 0x0CCD in 0:16 format
> > so:-
> >
> > F2 - F1 =  * 15 =  0x001B.9EB4 * 15 (this orders maintains lowest
> > calculation error)  = 0x019E.4C8C
> >
> > Now divide by 20 or multiply by 0x0.0CCD = 0x0014.B759DC1C => 20.716.
> >
> > Finally add the 40kPa 2300 rpm value to this, keeping track of the DP =
> > 0x006C.1A71DC1C. returning to the land of 32 bits this is equivalent to
> > 108.103. Honestly a LOT simpler than it looks. With your tables having a
> > hump you would only need to track the sign of results, which is possibly
> > simpler than tracking signed arithmetic. Anyhow it comes down very
> > simply:_
> >
> > For each kPa point store the difference between 0RPM value and 3500RPM
> > value divided by 3500 as a binary decimal.
> > This gives you 6 values in your scenario, call them K0 - K5, call the
> > pressures at these values P'0 - P'5
> >
> > read RPM (R), read kPa (P)(obviously if I have guessed wrongly
> > substitute whatever the axes represent)
> > if P exactly matches one of the stored values Kn simply multiply RPM by
> > Kn else
> > multply R * K(P'n<P) = Ix
> > multiply R * K(P'm>P) = Iy
> >
> > next calculate  Ix + (Iy - Ix) * (P-P'n)/(P'm-P'n)
> >
> > Might look a bit long winded, but by prestoring a lot of the calculable
> > values you can run the calcualtions very fast.
> >
> > Al
> >
> >
> >
> >
> > Rolf Bredemeier wrote:
> >
> > > Hi,
> > >
> > > i'm searching for an example for 2d linear interpolation.
> > > The data is in an array unsigned char [10][400].
> > >
> > > Here is my "worksheet", may be, it help's to explain for i looking on:
> > > http://www.nur-solutions.de/tmp/2dinterpol.gif
> > >
> > > There is the way to solve  the prob. for x-value 55 and y-value 800 =
> > > 59,35
> > >
> > > I need no floting point, unsigned char is only what i need.
> > >
> > > Best regards, Rolf
> > >
> > >
> > > Yahoo! Groups Sponsor
> > > ADVERTISEMENT
> > >
> > 
> <http://us.ard.yahoo.com/SIG=129f2ditf/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110610019/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
> >
> > >
> > >
> > >
> > > 
> ------------------------------------------------------------------------
> > > Yahoo! Groups Links
> > >
> > >     * To visit your group on the web, go to:
> > >       http://groups.yahoo.com/group/lpc2000/
> > >      
> > >     * To unsubscribe from this group, send an email to:
> > >       lpc2000-unsubscribe@yahoogroups.com
> > >       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> > >      
> > >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > >       Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> >
> >
> > *Yahoo! Groups Sponsor*
> > ADVERTISEMENT
> > click here
> > 
> <http://us.ard.yahoo.com/SIG=129hbc9up/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110648344/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
> >
> >
> >
> > *Yahoo! Groups Links*
> >
> >     * To visit your group on the web, go to:
> >       http://groups.yahoo.com/group/lpc2000/
> >       
> >     * To unsubscribe from this group, send an email to:
> >       lpc2000-unsubscribe@yahoogroups.com
> >       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >       
> >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >       Service <http://docs.yahoo.com/info/terms/>.
> >
> >
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=129agk7ev/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110650793/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Groups Links
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Onestone

very Nice! My brother used to race drag bikes years ago at Santa Pod. I 
believe that, at one time, he had the fastest time in Europe for any 
class of dragster, but that was over 25 years ago. I guessed you were 
mapping fuel. It must be an omen, and a good one  that one of my 
calculations resulted in 0x0666, the number of your personal beast!

Have you ever dynoed the bike? Obviously for the maximum possible 
performance you need to get the perfect balance between airand fuel in 
and exhaust capacity, such that all fuel is burnt, without an excess of 
air. In this manner you produce maximum power. Any deviation from the 
optimum burning mixture results in either excess, unburnt fuel, or 
excess unreacted air. In either case you are losing efficiency. In my 
experience fuel maps just aren't as simple as your example. even for ma 
given pressure they are not linear. I will email separately to your 
private address some fuel maps from a high pressure liquid LPG injection 
vehicle. Any deviation from optimal injection timing will give a drop in 
efficiency. many drag racers seem to be quite happy just using these 
crude linear maps thinking they can just throw fuel down the manifold 
and blow off the excess, unless you have more volumetric capacity than 
you can possibly handle this is not so.
Any way, since this is OT I'll follow uip privately.

Al

Rolf Bredemeier wrote:
Show quoted textHide quoted text
> Hi Al!
>
>
> ----- Original Message -----
> From: Onestone
> To: lpc2000@yahoogroups.com
> Sent: Friday, March 11, 2005 6:25 PM
> Subject: Re: [lpc2000] 2d linear Interpolation
>
>
> > Somebody's doing fuel maps from the look of this, however fuel maps 
> just
> > aren't linear the way yours are. You may as well just set the start
> > point and the end point thus:-
> > [...]
>
> Many, many thanks to you for thel lot of time you spend to me!
> I think, this hints will bring our drag bike to the top ten! ;-)
> if you like, you may take a look on it:
> http://www.markvanderkwaak.com/events/2003/drachten3/dr3_060.jpg
> (I am the boy in the middle)
>
> The motronic was made with an AVR, but realy not perfect. For my ugly 
> programing,
> the AVR had not enough power, to manage things like logging and 
> telemetrie.
> And the fuel cal was very bad, only one large table with 1d 
> interpolation for
> pressure. But, regardless of everything, it runs!
>
> Excuse me for the of-topic stuff.
>
> Best regard and many, many thanks again, Rolf
>
>
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=129t2no04/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110651381/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Groups Links
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>

RE: [lpc2000] 2d linear Interpolation

2005-03-11 by Paul Curtis

Hi Rolf, 

> Hi Paul,
> 
> thanks for reply.
> 
> ----- Original Message -----
> From: Paul Curtis
> To: lpc2000@yahoogroups.com
> Sent: Friday, March 11, 2005 1:05 PM
> Subject: RE: [lpc2000] 2d linear Interpolation
> 
> > Rolf,
> 
> > ...but this is a classic problem, such as interpolation of 
> ECU mapping 
> > parameters like engine speed against manifold pressure.  
> It's only a 
> > very simple piece of maths, what is the problem?  From what 
> I see on 
> > the GIF, the calculations are all laid out for you.  Hence, 
> I conclude 
> > it's a homework assignment and you'll never get anywhere if 
> others do 
> > your homework.
> 
> Yes, you are right. It is simple for me with paper and 
> pencil. But is much harder, to code it to C. I just started 
> with C. Is it so awfully, to ask for prepared source?
> I am not a lazy bone, the most of my free time is going in 
> self study for electronic and programing. Excuse me, if my 
> question had made you angry. 
> This was not my goal. Please dont take offence for me. And 
> excuse my english, it is self-learned, too. ;-)

I have absolutely no problem with people asking for help, but 2D
interpolation as I said is a classic problem.  There are some
processors, for instance, that have instruction for table lookupand
interpolation such as the CPU32 (TBLU).  I'd rather you looked at the
maths that is behind this.  2D interpolation is simply two 1D
interpolations, one along the X axis and then one along the Y axis (or
the other was round if you wish).

A 1D interpolation is simple, because you can figure out rise and run
between two points in the table (or, as Al points out, you might already
have that calculated)--but usually, when I was working on the software
for an ECU, the maps were changed in the ECU during runtime to see what
happens.  Given the slope, you can easily interpolate the value at a
point between them.

This is basic stuff that you should have learnt before your school
leaving exams.  In fact, you should have learnt curve fitting and things
such as linear regression too?

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

Re: [lpc2000] 2d linear Interpolation

2005-03-11 by Onestone

Paul Curtis wrote:

> This is basic stuff that you should have learnt before your school
> leaving exams.  In fact, you should have learnt curve fitting and things
> such as linear regression too?
>
This is what old farts do as they age.

Al

RE: [lpc2000] 2d linear Interpolation

2005-03-11 by Paul Curtis

Hi Al, 

> > This is basic stuff that you should have learnt before your school 
> > leaving exams.  In fact, you should have learnt curve fitting and 
> > things such as linear regression too?
> >
> This is what old farts do as they age.

Yes--I have a particularly nice fit to a convex curve around by midrif
now, which I'm trying to lose by gym attendance.  I am also undergoing
linear regression therapy to come to terms with my alien abduction in a
past life.  I believe I am a old fart, which I do on a regular basis
because of the high bean intake to reduce the convex curve.

So, your diagnosis is right on doctor.  :-)

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

Re: 2d linear Interpolation

2005-03-11 by peterburdine

--- In lpc2000@yahoogroups.com, "Rolf Bredemeier" <rolf_tt@y...> wrote:
> Hi,
> 
> i'm searching for an example for 2d linear interpolation.
> The data is in an array unsigned char [10][400].
> 
> Here is my "worksheet", may be, it help's to explain for i looking on:
> http://www.nur-solutions.de/tmp/2dinterpol.gif
> 
> There is the way to solve  the prob. for x-value 55 and y-value 800
= 59,35
> 
> I need no floting point, unsigned char is only what i need.
> 
> Best regards, Rolf

One possible solution is to use DSP.  Supersample the data (insert
0's) until you have the proper resolution then run it though a low
pass (interpolation) filter and pull out the value you need.  Might be
more compuationally intensive though.  

I think regression would be a bit of an over kill.

Re: OT[lpc2000] 2d linear Interpolation now non-linear spacial filling

2005-03-11 by Onestone

Fortunately a life of hectic activity meant that at the age of 47 I 
could still swim 150mtr underwater, run after my dumb dogs, body surf, 
lift heavy weights, and wear size 38 waist daks (trousers to non 
aussies, and just 2" more than my ultra fit army days 20 years earlier). 
then after a failed attempt to catch 1245kg I went up from just under 
100kg to 157kg, due to total inactivity and an enhanced love of food. I 
dropped 27kg between last Novemebr and the end of January through light 
excercise and heavy dieting, but then sneezed, stopped the excercise and 
slowed the diet, and am now back to a bulbous 135kg. It is bloody 
difficult to lose weight when vigorous excecise means walking to the 
bathroom, but I aim to be down to 110kg by May 18th, my thirtyleventh 
wedding anniversary, If only german cream cakes didn't taste so good! I 
too am suffering slippage and the weird effcts of old age. My wife used 
to make jokes about the smattering (record 12) of hairs on my chest, now 
I look like someone who rolled on a rug after coating themselves in 
superglue, my pug is better looking than I am, I'm no longer sure if I 
remember incidents from when I was 16 months old, or if I have regressed 
that far, I'm hoping it's the latter and suddenly I'll be young again, 
just as long as I'm not as dumb as I was then ;@}

Al

Paul Curtis wrote:
Show quoted textHide quoted text
> Hi Al,
>
> > > This is basic stuff that you should have learnt before your school
> > > leaving exams.  In fact, you should have learnt curve fitting and
> > > things such as linear regression too?
> > >
> > This is what old farts do as they age.
>
> Yes--I have a particularly nice fit to a convex curve around by midrif
> now, which I'm trying to lose by gym attendance.  I am also undergoing
> linear regression therapy to come to terms with my alien abduction in a
> past life.  I believe I am a old fart, which I do on a regular basis
> because of the high bean intake to reduce the convex curve.
>
> So, your diagnosis is right on doctor.  :-)
>
> --
> Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=129p31ct2/M=298184.6018725.7038619.3001176/D=groups/S=1706554205:HM/EXP=1110655080/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> 
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Groups Links
>
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>

Re: 2d linear Interpolation

2005-03-13 by Owen Mooney

>> One possible solution is to use DSP. Supersample the data (insert >> 
0's) until you have the proper resolution then run it though a low
 >> pass (interpolation) filter and pull out the value you need. Might be
 >> more compuationally intensive though.
 >>
 >> I think regression would be a bit of an over kill.

Actually it doesn't have to be computationally intensive. If you use a 
FIR filter (eg a windowed Sin(x)/x function) you will only have to 
calculate the output for the single point that you want. In additon , 
most of the input samples are zero - so there is no need to include them 
in the computation. - instead you just resample the windowed FIR 
coefficients to match the origional sample rate of the data. The 
computation is not to bad at all.

So you see that some of us with grey hair have some uses after all.


OLD FARTS RULE !!!!!    :-)

Owen Mooney

Re: 2d linear Interpolation

2005-03-14 by fredrikssonjohan

When browsing thrue Microchips site I found a PDF about linear
interpolation that might be of interest for you.

Download it at 
http://ww1.microchip.com/downloads/en/AppNotes/00942A.pdf

Cheers
/Johan

--- In lpc2000@yahoogroups.com, "Rolf Bredemeier" <rolf_tt@y...> 
wrote:
> Hi,
> 
> i'm searching for an example for 2d linear interpolation.
> The data is in an array unsigned char [10][400].
> 
> Here is my "worksheet", may be, it help's to explain for i looking 
on:
> http://www.nur-solutions.de/tmp/2dinterpol.gif
> 
> There is the way to solve  the prob. for x-value 55 and y-value 
800 = 59,35
Show quoted textHide quoted text
> 
> I need no floting point, unsigned char is only what i need.
> 
> Best regards, Rolf

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.