Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のコードがあります
[X1,Y1]=meshgrid(1:5,1:5); z=X1.^2+Y1.^2 [X2,Y2]=meshgrid([1 2 3 3.5 4 5],[1 2 3 3.5 4 5]); z2=interp2(X1,Y1,z,X2,Y2) mesh(X2,Y2,z2)
コマンド mesh(z2) などのデータを構造化して同じ結果を生成する方法はありますか?
あなたが何を求めているのか正確にはわかりませんが、同じことを行うためにコード内の数行を切り取ることができます:
[X2,Y2]=meshgrid([1 2 3 3.5 4 5],[1 2 3 3.5 4 5]); z2=X2.^2+Y2.^2; mesh(X2,Y2,z2);
または、次のようにすることもできます。
[X1,Y1]=meshgrid(1:5,1:5); z=X1.^2+Y1.^2; mesh(z);
この特定の例では、2 つの方法に大きな違いは見られないと思います。