How to combine two functions in one graph?

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.

답변 (2개)

Jan
Jan 2013년 5월 6일

0 개 추천

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));

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2013년 5월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by