「interp2」におけるクエリ点について

11 visualizzazioni (ultimi 30 giorni)
雅晶
雅晶 il 19 Dic 2022
Commentato: COVAO il 23 Apr 2023
meshgrid 形式の 2 次元グリッド データの内挿で用いられる「interp2」において、
ドキュメンテーションでは、クエリ点「Xq、Yq」は実数のスカラーとして指定できるとあります。
そこで質問なのですが、具体的には「interp2」を使用する際、どのような場合にクエリ点を実数のスカラーとして指定するのか例を交えて説明いただけると助かります。
よろしくお願いいたします。
  1 Commento
COVAO
COVAO il 23 Apr 2023
interp2 は格子点X,YとZで表される2D ルックアップテーブルで、Xq, YqにおけるZqを補間計算します。
以下はクエリ点をプロットする例です。
% Generate grid data
x = linspace(0, 5, 10);
y = linspace(0, 5, 10);
[X, Y] = meshgrid(x, y);
Z = sin(X) + cos(Y);
% Specify the query point as a real scalar
xq = 1.3;
yq = 4.1;
% Interpolate the data using the interp2() function
Zq = interp2(X, Y, Z, xq, yq, 'linear');
% Show results
surf(X, Y, Z);
hold on;
scatter3(xq, yq, Zq, 20, 'r', 'filled');
xlabel('X');
ylabel('Y');
zlabel('Z');
s=sprintf('Interpolated value at (xq, yq) = (%.2f, %.2f) is: %.4f\n', xq, yq, Zq);
title(s);

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su 内挿 in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!