Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Logarithmic Interpolation

825 views
Skip to first unread message

rudzi

unread,
Oct 24, 2008, 9:58:57 AM10/24/08
to
Hi,

How I could apply logarithmic interpolation in my data. I used interp1, but it doesn't have reasonable curves when it comes to semilog curves. As far as I know,interp1 is for linear interpolation. Do I have to come up with my own codes? Pls give a piece of advice.
Many thanks.

Aaron Callard

unread,
Oct 24, 2008, 12:19:01 PM10/24/08
to
What I have always done is just apply a log, interpolate, then convert back to linear.

i.e.
% set up data to interpolate
data_linear=10.^(-10:1:0);
% convert to log
data_log = 10*log10(data_linear);
% interpolate
data_log_intepolated =interp1(0:10,data_log,2:0.1:9);
% convert back
data_linear_intepolated = 10.^(data_log_intepolated/10);

rudzi <ee...@bristol.ac.uk> wrote in message <23210557.1224856768...@nitrogen.mathforum.org>...

Scott

unread,
Feb 21, 2013, 8:48:05 PM2/21/13
to
The following works for data such as a spectrum of noise power in dB versus frequency, where we have a linear y-axis and a logarithmic x-axis and a few data points with linear transitions between the points. The trick is to take the log of the frequency vectors when interpolating. Note I repeated the last data point in this case because the data is flat beyond f=10^4.

f = logspace(1,8,1000) ;
data = interp1( log10([1,3,4, max(f)]), [-100, -120, -130, -130], log10(f)) ;
semilogx(f, data) ;
0 new messages