フィルターのクリア

How to extrapolate gridded matrix?

10 ビュー (過去 30 日間)
Isa Duran
Isa Duran 2016 年 3 月 15 日
コメント済み: Andrei Bobrov 2016 年 3 月 15 日
Hi all! I am trying to extrapolate a matrix, but it seems like there is some issues. I have the rows as variable Hs:
Hs = [4.9573 6.6098 8.2622 9.9147 13.2196 16.5245 24.7868 33.0490]
And the Collums as Uw:
Uw = [1.12 2.4500 4.4000 6.7000 9.3500 12.3000]
And the RPM as the "main" matrix:
RPM = 8x6 matrix
So for a given Hs and Uw, there is a RPM.
I want to create a new matrix where Hs and Uw is extrapolated to 0. So the original "main" matrix is extended to a 9x7 matrix where Hs and Uw start from the value 0.
Hope it makes sense otherwise feel free to ask!
Thanks is advance Isa

採用された回答

Andrei Bobrov
Andrei Bobrov 2016 年 3 月 15 日
use scatteredInterpolant
Hs = [4.9573 6.6098 8.2622 9.9147 13.2196 16.5245 24.7868 33.0490];
Uw = [1.12 2.4500 4.4000 6.7000 9.3500 12.3000];
% RPM non datas
[x,y] = ndgrid(Hs,Uw);
F = scatteredInterpolant(x(:),y(:),RPM(:));
[x1,y1] = ndgrid([0 Hs],[0 Uw]);
out = F(x1,y1);
  2 件のコメント
Isa Duran
Isa Duran 2016 年 3 月 15 日
Awesome! Thank you a lot Andrei!
Guillaume
Guillaume 2016 年 3 月 15 日
Well actually, since the data is gridded, griddedInterpolant is more appropriate.

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

その他の回答 (1 件)

Guillaume
Guillaume 2016 年 3 月 15 日
"but it seems like there is some issues" Unless you tell us what the issues are, we can't guess what they are.
Hs = [4.9573 6.6098 8.2622 9.9147 13.2196 16.5245 24.7868 33.0490];
Uw = [1.12 2.4500 4.4000 6.7000 9.3500 12.3000];
rpm = reshape(1:8*6, 8, 6); %demo data since none was provided
[gridrows, gridcols] = ndgrid(Hs, Uw);
ginter = griddedInterpolant(gridrows, gridcols, rpm); %create gridded interpolant. Does linear extrapolation by default
%add extrapolation for 0 column
rpm = [ginter(Hs', zeros(size(Hs))'), rpm];
Hs = [0, Hs];
Uw = [0, Uw];
rpm = [ginter(zeros(size(Uw)), Uw); rpm]
  1 件のコメント
Andrei Bobrov
Andrei Bobrov 2016 年 3 月 15 日
+1

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by