sfit型からの3次元等高線の作成

14 views (last 30 days)
iga50storm
iga50storm on 16 Nov 2017
Edited: Jiro Doke on 17 Nov 2017
まず、測定点間を補間する曲面を"fit"関数を使って近似し、この操作によりsfitの型に近似曲面が作られました。 そのあと"plot"関数を用いて図の通り3次元の曲面と2次元の等高線をつくる所までできました。 しかし、3次元の等高線が作れず困っています。解決方法があれば教えていただけないでしょうか? (Web上で色々調べたのですが、plot関数でsfit型からの3次元等高線の命令が見つかりませんでした。)
x=[1;1;2;2;2;2;3;3;3;3;4;4];
y=[2;3;1;2;3;4;1;2;3;4;2;3];
Z=[89;90.7;87.5;90.9;91.8;90.4;90.5;90.1;86.1;91.8;91;92.3];
sf = fit([x, y],Z,'cubicinterp');
%3次元プロット
figure;
plot(sf,[x,y],Z);
%等高線プロット
figure;
plot(sf, [x,y],Z,'Style', 'Contour');
  2 Comments
michio
michio on 16 Nov 2017
3次元等高線とはどういうイメージでしょうか?何か参考になる画像があれば教えてください。
iga50storm
iga50storm on 16 Nov 2017
コメントありがとうございます。 contour3で描かれる等高線をイメージしています。

Sign in to comment.

Accepted Answer

Jiro Doke
Jiro Doke on 16 Nov 2017
Edited: Jiro Doke on 17 Nov 2017
sfit オブジェクトを使って X Y のグリッドに対して再評価し、 contour3 を呼べば良いと思います。
xx = linspace(min(x),max(x));
yy = linspace(min(y),max(y));
[XX,YY] = meshgrid(xx,yy);
ZZ = sf(XX,YY);
figure
contour3(XX,YY,ZZ,30)
  1 Comment
iga50storm
iga50storm on 16 Nov 2017
解決致しました。 ご丁寧にソースコードまでありがとうございました。

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!