フィルターのクリア

TriScatteredInterp Issues - Function to Fit Data

1 回表示 (過去 30 日間)
Ed
Ed 2013 年 4 月 24 日
I have data that is acquired over several hours at non-standard sampling rates. This non- monotonically increasing dataset means that I'll have to use triscatteredinterp, but I'm having issues with the function:
*Error using TriScatteredInterp Input data point locations have invalid dimension. The data must be specified in column-vector format.
Error in BGHistoryScript (line 41) F=TriScatteredInterp(x,y1);*
I have a large matrix BGData (8202x5) with my time values as the first column, and count-rate values as columns 2-5.
The independent variable (x) will be column 1 of BGData, with the corresponding y's as columns 2-5. I ultimately need to obtain functions for each y column with respect to time (x).
My code snippet:
x=BGData(:,1);
y1=BGData(:,2);
y2=BGData(:,3);
y3=BGData(:,4);
y4=BGData(:,5);
F=TriScatteredInterp(x,y1);
Tmin=BGData(1,1);
Tmax=max(BGData(m,1));
tvals=linspace(Tmin,Tmax,1000);
[qx,qy]=meshgrid(tvals);
Any help would be much appreciated. Thanks in advance...
  1 件のコメント
Ed
Ed 2013 年 4 月 26 日
Any advice?

サインインしてコメントする。

回答 (2 件)

Sean de Wolski
Sean de Wolski 2013 年 4 月 24 日
You are defining y1 as a single column. Thus you have a x and y both as column vectors and no z. So this is not a 2d problem, but rather a 1d problem.
For this, use interp1
doc interp1
  2 件のコメント
Ed
Ed 2013 年 4 月 25 日
I tried this:
tvals=linspace(Tmin,Tmax,10000);
F1=interp1(x,y1,tvals);
I get this error:
Error using griddedInterpolant
The grid vectors are not strictly monotonic increasing.
Error in interp1>Interp1D (line 346)
F = griddedInterpolant(Xext,V,method);
Error in interp1 (line 241)
Vq = Interp1D(X,V,Xq,method);
Error in BGHistoryScript (line 29)
F1=interp1(x,y1,tvals);
Sean de Wolski
Sean de Wolski 2013 年 4 月 25 日
It sounds like you need to sort() the data before passing it into interp1().

サインインしてコメントする。


Ed
Ed 2013 年 4 月 25 日
I had initially tried the spline fits/interp, but my problem is the random X-spacing:
Note: If you pass non-uniformly spaced points and specify the 'v5cubic' method, interp1 will now issue a warning. In addition, the following syntaxes will be removed or changed in a future release:

カテゴリ

Help Center および File ExchangeEye Tracking についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by