sfit型からの2次元等高線の補間

11 visualizaciones (últimos 30 días)
takeshi moriya
takeshi moriya el 21 de Dic. de 2018
Respondida: Akira Agata el 21 de Dic. de 2018
5×5の合計25点の測定点の間を補間する曲面をfit関数を使って近似し、この操作によりsfitの型に近似曲面をつくりました。
その後2次元の等高線を作成しました.
この等高線を測定点外に拡張したいのですが、どうすればよいでしょう。
例えば今回なら軸のメモリはそれぞれ1から5ですが、それを0から6に変更して拡張された区域を補間するにはどうすればよいでしょう。faq.jpg
clearvars
xx = linspace(1,5);
yy = linspace(1,5);
[XX,YY] = meshgrid(xx,yy);
x1=[1;1;1;1;1;
2;2;2;2;2;
3;3;3;3;3;
4;4;4;4;4;
5;5;5;5;5];
y1=[1;2;3;4;5;
1;2;3;4;5;
1;2;3;4;5;
1;2;3;4;5;
1;2;3;4;5;];
Z1=[34.4;40.2;42.5;41.7;37.9;
30.8;36.0;38.1;37.2;33.8;
30.6;35.0;36.6;35.6;32.1;
32.5;36.8;38.2;36.8;32.7;
36.9;41.8;42.9;40.7;36.5];
sf1 = fit([x1, y1],Z1,'lowess');
ZZ = sf1(XX,YY);
figure
pbaspect([1 1 1]);
hold on
contourf(XX,YY,ZZ,'ShowText','on')
hold off

Respuestas (1)

Akira Agata
Akira Agata el 21 de Dic. de 2018
外挿になるので 'lowess' のような手法は使えませんが、scatteredInterpolant 関数を使うと、以下のように線形での内挿・外挿を同時にすることができます。
F = scatteredInterpolant(x1(:),y1(:),z1(:),'linear','linear');
xx = linspace(0,6);
yy = linspace(0,6);
[XX,YY] = meshgrid(xx,yy);
ZZ = F(XX,YY);
scatteredInterpolant.png

Categorías

Más información sobre 内挿 en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!