How to create a consolidated 'average' surface of three or more surfaces?

1 回表示 (過去 30 日間)
A
A 2014 年 5 月 23 日
コメント済み: A 2014 年 5 月 24 日
I have three surfaces as follows:
Z1 = x + y; Z2 = 2x + y; Z3 = 3x +y;
How can I create a consolidated 'average' graph of all three equations?
Thank you

採用された回答

arich82
arich82 2014 年 5 月 23 日
It's not entirely clear (to me) what you want, but you can simply take the avg of z and plot it if that's what you want:
%%make data
[X, Y] = meshgrid(-2:0.2:2, -3:0.3:3);
Z(:, :, 1) = X + Y;
Z(:, :, 2) = 2*X + Y;
Z(:, :, 3) = 3*X + Y;
%%compute average
% simple approach:
% Z_avg = (Z1 + Z2 + Z3)/3; % for this example, Z_avg and Z2 are equivalent
% more generally:
Z_avg = mean(Z, 3);
%%plot original data
k = 1;
hf(k) = figure('WindowStyle', 'docked');
ha(k) = axes;
hold(ha(k), 'all');
hs(1) = surf(ha(k), X, Y, Z(:, :, 1));
hs(2) = surf(ha(k), X, Y, Z(:, :, 2));
hs(3) = surf(ha(k), X, Y, Z(:, :, 3));
view(3);
grid(ha(k), 'on');
title(ha(k), 'original planes');
%%plot avg.
k = 2;
hf(k) = figure('WindowStyle', 'docked');
ha(k) = axes;
hs(4) = surf(ha(k), X, Y, Z_avg);
view(3);
grid(ha(k), 'on');
title(ha(k), 'avg. plane');
It seems like you've been asking variations of this question for quite some time; is this what you were looking for? If not, what aspect are you confused about?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by