MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Linear interpolation problem 

Subject: Linear interpolation problem From: Heinrich Acker Date: 7 Nov, 2012 19:46:09 Message: 1 of 19 
Dear Matlab users, 
On Thursday, November 8, 2012 8:46:09 AM UTC+13, Heinrich Acker wrote: 
Subject: Linear interpolation problem From: Heinrich Acker Date: 8 Nov, 2012 10:23:08 Message: 3 of 19 
Thank you, TideMan for these hints. In my application, the function is unknown, and linear approximation is already chosen for runtime reasons. With my example, I did not use real data, but wanted to illustrate the fact that the result delivered by 'interp1' is not the best result possible with linear approximation. I am looking for an algorithm that performs better with the same type of approximation. As you can see from my example, 'interp1' does not minimize the maximum error in the data set. 
"Heinrich Acker" wrote in message <k7g16b$3j6$1@newscl01ah.mathworks.com>... 
Subject: Linear interpolation problem From: Heinrich Acker Date: 8 Nov, 2012 13:57:07 Message: 5 of 19 
Perhaps I should have explained this in more detail at the beginning. The application is in embedded control, a tiny 16bit µC will do the actual approximation, and it already has a critical workload. Because of this, it is already decided for the project to use linear interpolation, since the combination of indexing, one multiplication, and one addition fits into the loop. I want to use Matlab to supply the embedded software with calibration data. I currently use 'interp1' to do this. From plots similar to the code example given, I have seen that it does not deliver the optimal result (if the maximum error is regarded as the cost). I have to deliver to the µC system a set of gain and offset values with a fixed number of values. How can I minimize the maximum error? 
"Heinrich Acker" wrote in message <k7gdnj$g6r$1@newscl01ah.mathworks.com>... 
Subject: Linear interpolation problem From: Heinrich Acker Date: 8 Nov, 2012 16:08:17 Message: 7 of 19 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k7gin4$55m$1@newscl01ah.mathworks.com>... 
"Heinrich Acker" wrote in message <k7gldh$gdg$1@newscl01ah.mathworks.com>... 
On 11/8/2012 10:08 AM, Heinrich Acker wrote: 
Subject: Linear interpolation problem From: Heinrich Acker Date: 9 Nov, 2012 13:58:08 Message: 10 of 19 
dpb <none@non.net> wrote in message <k7h5dl$3ts$1@speranza.aioe.org>... 
Subject: Linear interpolation problem From: Heinrich Acker Date: 9 Nov, 2012 14:31:13 Message: 11 of 19 
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k7h06h$ab$1@newscl01ah.mathworks.com>... 
On 11/9/2012 7:58 AM, Heinrich Acker wrote: 
On 11/9/2012 7:58 AM, Heinrich Acker wrote: 
On 11/9/2012 8:31 AM, Heinrich Acker wrote: 
On 11/9/2012 8:31 AM, Heinrich Acker wrote: 
Subject: Linear interpolation problem From: John D'Errico Date: 9 Nov, 2012 23:54:11 Message: 16 of 19 
"Heinrich Acker" wrote in message <k7edq1$akq$1@newscl01ah.mathworks.com>... 
Subject: Linear interpolation problem From: Heinrich Acker Date: 12 Nov, 2012 17:54:16 Message: 17 of 19 
dpb <none@non.net> wrote in message <k7jtmg$jtn$1@speranza.aioe.org>... 
Subject: Linear interpolation problem From: Heinrich Acker Date: 12 Nov, 2012 18:29:15 Message: 18 of 19 
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <k7k533$r8b$1@newscl01ah.mathworks.com>... 
On 11/12/2012 11:54 AM, Heinrich Acker wrote: 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.