How to combine two functions in one graph?
Afficher commentaires plus anciens
How do I combine two functions in one graph and find the average value of that graph. The first function ranges from 0 to 85 degrees and the other one from 85 to 180 degrees.
Réponses (2)
José-Luis
le 6 Mai 2013
hold on
Jan
le 6 Mai 2013
The more details you post, the less we have to invent.
x = 1:100;
y1 = rand(1, 100) * 85;
y2 = rand(1, 100) * 95 + 85;
plot(x, y1, x, y2);
% Or:
AxesH = axes('nextplot', 'add');
plot(AxesH, x, y1);
plot(AxesH, x, y2);
meanY = (y1 + y2) * 0.5;
Or perhaps "average value" means:
meanY = sum(y1 + y2) / (2 * length(x));
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!