私は新しい MATLAB ユーザーで、関数をプロットしようとしています。
function [ uncertainty ] = uncertain(s1, s2, p)
%UNCERTAIN calculates the measurement uncertainty of a triangulation
% provide two coordinates of known stations and a target coordinate
% of another point, then you get the uncertainty
[theta1, dist1] = cart2pol(p(1)-s1(1), p(2)-s1(2));
[theta2, dist2] = cart2pol(p(1)-s1(1), p(2)-s2(2));
theta=abs(pi-theta2-theta1);
uncertainty = dist1*dist2/abs(sin(theta));
end
で呼び出されます:
uncertain([0 0],[8 0],[4 4])
単一の結果が得られます。しかし、私は表面全体が必要で、次のように呼びました:
x=-2:.1:10;
y=-2:.1:10;
z = uncertain([0 0],[8 0],[x y]);
mesh(x,y,z)
「Z はスカラーやベクトルではなく、行列でなければなりません」というエラーが表示されます。
関数がサーフェスを描画するようにコードを変更するにはどうすればよいですか?
前もって感謝します。ラルフ。