Search code examples
matlabsolvernumerical-integration

solve for a parameter such that area under curve equals 1


I have just found that I can use the function trapz in Matlab to find the area under a curve given a vector. What I want to do is to normalize the values in this vector in such that the area under the curve equals 1. let's say that x is a single scaling factor such that:

Area_Under_curve(x * V) = 1

How can I find x?


Solution

  • I think

    x = 1/trapz(V)
    

    will do just that :)