interpolating over vectors and matrices

1 Ansicht (letzte 30 Tage)
Richard
Richard am 14 Aug. 2012
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?

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by