Scattered Interpolant possible with multiple sample value vectors?

11 ビュー (過去 30 日間)
Yuri Engelshoven
Yuri Engelshoven 2015 年 3 月 20 日
コメント済み: Andrei Bobrov 2015 年 3 月 22 日
Hey guys,
I'm trying to build an interpolant which should give me interpolants for 8 different sample value vectors. I have an 95374*8 double list of sample values (UF). Corresponding to which there are two 95374*1 double coordinate lists (xe & ye).
I'm trying to build a loop in which the scatteredinterpolant F is constructed for each of these 8 sample value lists. Thing is that I don't know if it is even possible to create a scatteredinterpolant which consists of more than one value list?
Matlab tells me my F (if i take one set of values) is 1x1. So is it possible to make it 1x8? That looks like this:
%if true
F=scatteredInterpolant(xe,ye,UF(:,1),'natural');
I've tried making something like this, but it won't work as I cant tell matlab to put the values next to the already existing ones:
if true
for i=1:8
F(:,:,i)=scatteredInterpolant(xe,ye,UF(:,i),'natural');
end
The error this yields after the first iteration is: Error using scatteredInterpolant/subsasgn Invalid arguments in indexing operation.
If you guys could help me out that would be awesome! Thanks in advance.

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 3 月 20 日
Please try this:
F = cell(8,1);
for ii =1:8
F{ii} = scatteredInterpolant(xe,ye,UF(:,ii),'natural');
end
  3 件のコメント
Yuri Engelshoven
Yuri Engelshoven 2015 年 3 月 20 日
The problem that comes up now is that when I try to evaluate a certain point in one of the cells of F, an error comes up because Matlab now reads it as a single cell in stead of a scatteredpinterpolant.
if true
for i=1:8
% FF=cell2mat(F(:,i)) this operation doesnt work either.
FF=F(:,1);
T(:,1)=XX(:,i);
T(:,2)=YY(:,i);
T=double(T);
UFI(:,i)=FF(T)
end
end
The error i get is: Subscript indices must either be real positive integers or logicals. Line 254 UFI(:,i)=FF(T)
Any clue on how to solve this?
Andrei Bobrov
Andrei Bobrov 2015 年 3 月 22 日
UFI = zeros(size(XX,1),8);
for jj = 1:8
UFI(:,jj) = F{jj}(XX(:,jj),YY(:,jj));
end

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by