How to create a consolidated 'average' surface of three or more surfaces?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
arich82
il 23 Mag 2014
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?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!