interpolating over vectors and matrices

1 view (last 30 days)
Consider the following example:
time = 1/24:1/24:365;
period = 0:0.0232:1.964;
power = 0 + (1-0)*rand(85,8760);
pcolor(time,period,power);shading interp
This example shows how the power of a certain periodicity ('period') from a signal changes in time. From this I would like to perform some further analysis on a period that lies between 2 of the period shown above. I would like to look closer at how the power at a period of 0.0417 changes in time. However, this period lies between period(2) and period(3). Is there a method for interpolating over the vector 'period', and matrix 'power' to generate a reasonable estimate of the power at 0.0417?

Accepted Answer

Sean de Wolski
Sean de Wolski on 14 Aug 2012
[pp tt] = ndgrid(period,time);
G = griddedInterpolant(pp,tt,power);
G(0.0417,3)
This is making the assumption that you want a two dimensional interpolation. If you would like a one dimensional interpolation across columns, you can use interp1 directly.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!