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

46 vues (au cours des 30 derniers jours)
Belal Abboushi
Belal Abboushi le 21 Jan 2015
Commenté : Image Analyst le 21 Jan 2015
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?

Réponse acceptée

Mohammad Abouali
Mohammad Abouali le 21 Jan 2015
Modifié(e) : Mohammad Abouali le 21 Jan 2015
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 commentaire
Image Analyst
Image Analyst le 21 Jan 2015
Belal's "Answer" moved here:
You saved my life! Thanks a lot

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by