插值间隔不规则的3D矩阵在MATLAB [英] Interpolating irregularly spaced 3D matrix in matlab

查看:887
本文介绍了插值间隔不规则的3D矩阵在MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个时间序列,我想插温度分布,我想问问怎么做,如果我的数据被不规则地间隔。

I have a time series of temperature profiles that I want to interpolate, I want to ask how to do this if my data is irregularly spaced.

下面是基质的细节:

  • 在温度为30x365
  • 的时间是1x365
  • 在深度为30X1

无论时间和深度是不规则地间隔开。我想问我怎么能插成规则的网格?

Both time and depth are irregularly spaced. I want to ask how I can interpolate them into a regular grid?

我已经看过 interp2 TriScatteredInterp 在Matlab,但是问题如下:

I have looked at interp2 and TriScatteredInterp in Matlab, however the problem are the following:

  1. interp2 只有当数据在常规电网。
  2. TriscatteredInterp 只有当该向量是列向量。虽然时间和深度都是列向量,温度不是。
  1. interp2 works only if data is in a regular grid.
  2. TriscatteredInterp works only if the vectors are column vectors. Although time and depth are both column vectors, temperature is not.

感谢。

推荐答案

功能 Interp2 不需要了的规则间隔的测量网格在所有,只需要一个 单调之一。存储在载体,采样位置深度必须增加(或减少),而这一切。

Function Interp2 does not require for a regularly spaced measurement grid at all, it only requires a monotonic one. That is, sampling positions stored in vectors depths and times must increase (or decrease) and that's all.

假设这确实是情况的*,并要插在常规位置的存储载体** rdepths rtimes ,你可以这样做:

Assuming this is indeed is the situation* and that you want to interpolate at regular positions** stored in vectors rdepths and rtimes, you can do:

[JT, JD] = meshgrid(times, depths); %% The irregular measurement grid
[RT, RD] = meshgrid(rtimes, rdepths); %% The regular interpolation grid
TemperaturesOnRegularGrid = interp2(JT, JD, TemperaturesOnIrregularGrid, RT, RD);


* :如果没有,你可以对行和列进行排序回来单调电网
。 *
的*:实际上 Interp2 没有限制的输出网格(也可以是不规则的,甚至非单调)


* : If not, you can sort on rows and columns to come back to a monotonic grid.
*
*: In fact Interp2 has no restriction for output grid (it can be irregular or even non-monotonic).

这篇关于插值间隔不规则的3D矩阵在MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆