• IDL Interpolate()函数


    Interpolate()函数:可以将数组调整到同维任意大小,并支持任意定位差值。调用格式为

    Interpolate(数组,X[,Y[,Z]][,关键字])

    例子:

    IDL> arr=findgen(2,2)
    IDL> print,arr
         0.000000      1.00000
          2.00000      3.00000
    IDL> ;采用线性内插方式获取数组arr中[0,0] [0.5,0.5] [1.5,1.5]位置的值
    IDL> print,interpolate(arr,[0,.5,1.5],[0,.5,1.5])
         0.000000      1.50000      3.00000
    IDL> ;采用线性内插方式获取数组arr中0 0.5 1.5行的值
    IDL> print,interpolate(arr,[0,.5,1.5])
         0.000000      1.00000
          1.00000      2.00000
          2.00000      3.00000
    IDL> ;采用网格差值方式获取数组arr中[0,0] [0.5,0.5] [1.5,1.5]位置的值
    IDL> print,interpolate(arr,[0,.5,1.5],[0,.5,1.5],/grid)
         0.000000     0.500000      1.00000
          1.00000      1.50000      2.00000
          2.00000      2.50000      3.00000
    IDL> ;missing为差值点坐标超出数组自身坐标范围时赋予该值
    IDL> print,interpolate(arr,[0,.5,1.5],[0,.5,1.5],/grid,missing=0)
         0.000000 0.500000 0.000000
          1.00000  1.50000 0.000000
         0.000000 0.000000 0.000000
  • 相关阅读:
    newman
    集合自动化
    56. Merge Intervals
    55. Jump Game
    48. Rotate Image
    34. Search for a Range
    33. Search in Rotated Sorted Array
    16. 3Sum Closest
    15. 3Sum
    11. Container With Most Water
  • 原文地址:https://www.cnblogs.com/wintertone/p/6581934.html
Copyright © 2020-2023  润新知