Using interp2 for several functions
古いコメントを表示
I am using interp2 in the way shown below(Only two lines to demonstrate what i mean). However. I have many lines of code with only the function (f1,f2..fn)changing. Is there a way of being able to produce these outputed matrices more efficently? and if so can they be seperated or do they have to be in one large matrix?
test = interp2(x,y,f1,xq,yq);
test2 = interp2(x,y,f2,xq,yq);
3 件のコメント
Stephen23
2021 年 3 月 25 日
Use a simple loop. Storing the data in arrays will make this a lot easier (compared to numbered variables).
James Rodriguez
2021 年 3 月 25 日
Matt J
2021 年 3 月 25 日
Are the query points xq,yq gridded or scattered?
回答 (1 件)
fCell = {f1,f2,...,fn};
n=numel(fCell);
G=griddedInterpolant({y,x},fCell{1});
test=cell(1,n);
for i=1:n
G.Values=fCell{i};
test{i}=G(yq,xq);
end
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!