How to combine two functions in one graph?
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Jan
on 6 May 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));
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!