How to normalize curves such that area under curve=1?

I'm trying to plot three curves such that area under curve =1. I've tried trapz but it only gives me the area and i couldn't change it.
Any idea?

 採用された回答

Mohammad Abouali
Mohammad Abouali 2015 年 1 月 21 日
編集済み: Mohammad Abouali 2015 年 1 月 21 日

1 投票

divide all numbers by the area that you calculate using Trapz.
x=0:0.1:pi;
y=sin(x);
Area=trapz(x,y)
Area =
1.9975
y_normalized=y./Area;
trapz(x, y_normalized)
ans =
1.0000

1 件のコメント

Image Analyst
Image Analyst 2015 年 1 月 21 日
Belal's "Answer" moved here:
You saved my life! Thanks a lot

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by