2017-05-08 18 views
0

我有以下格,僅在點評價函數:使用阿克瑪包線性內插:interp的一個非常不規則網格

我無法設置數據的x,y,和z所以可以使用

interp(x,y,z) 

有誰知道這是甚至可能嗎? Akima說它支持不規則的間隔網格。

數據:

categoryvector=21 
ninterp=4 
points = seq(0,categoryvector,by=ceil(((categoryvector - 0)/(ninterp - 1)))) 
if(!categoryvector%in%points){points=c(points,categoryvector)} 
if(!1%in%points){points=c(points,1); points=sort(points)} 
keepers = data.table(expand.grid(prod1vint1=points,prod1vint2=points)) 
points1 = c(keepers$prod1vint1,0:categoryvector,rep(0,categoryvector+1),rep(categoryvector,categoryvector+1),0:categoryvector) 
points2 = c(keepers$prod1vint2,rep(0,categoryvector+1),0:categoryvector,0:categoryvector,rep(categoryvector,categoryvector+1)) 

z =data.table(points1=points1,points2=points2,z=rnorm(length(points2),10,3)) 

提高電網:enter image description here

+0

請分享一個可重現的例子。 – Axeman

+0

@Axeman ok添加了一個可重現的例子,試圖在z上插入或使用interp – robertevansanders

回答

1

我認爲你正在尋找interppinterp

+0

所以這意味着我不需要設置矩陣,並且可以有任何實際的凸點集來進行插值。 – robertevansanders

+0

如果我沒有記錯的話,你只需要在它上面輸入一組座標和值,它會返回很好的網格值(當然,你必須指定網格)。 – Lyngbakr

+0

它表示它已被棄用並使用interpp ..這看起來像一個奇怪的warninig,因爲那正是我使用的! – robertevansanders

相關問題