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 件)
José-Luis
2013 年 5 月 6 日
hold on
Jan
2013 年 5 月 6 日
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 で Just for fun についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!