1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB help: determining the area under a plot (not a curve whose form is known)

  1. Apr 13, 2008 #1
    Hi

    For a project (described here), I have to do the following for N images:

    1. plot the histogram of each image, using

    imhist(x)

    2. plot a curvilinear approximation to the histogram, using

    plot(imhist(x))

    3. determine the area under the plot generated in step 2

    4. Plot a curve of area value versus image number (index) and determine the image number for which the area value is a minimum.

    I am not sure how to do step 3 and also whether steps 1 and 2 are correct.

    Can someone please help?

    Thanks and cheers
    vivek
     
  2. jcsd
  3. Apr 13, 2008 #2
    If step 2 is continuous then try the MATLAB command 'trapz'.
    Go:
    help trapz
    in the MATLAB command window. Hopefully you can do:
    trapz(imhist(x))
     
  4. Apr 13, 2008 #3
    Should I do

    trapz(imhist(x))

    or

    trapz(plot(imhist(x))

    ?

    plot(imhist(x)) plots the histogram with the peaks joined by a not-so-smooth curve...
     
  5. Apr 14, 2008 #4
    You should do:
    trapz(imhist(x))

    Now you say that plot(imhist(x)) plots a histogram with peaks joined by a curve? I assume you want the area under that curve? If thats the case I don't think trapz will help - you need to JUST plot the peaks and trapz will give the area under that curve.
     
  6. Apr 20, 2008 #5
    Thanks
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: MATLAB help: determining the area under a plot (not a curve whose form is known)
  1. Help with MatLab plot (Replies: 0)

  2. MATLAB: Plotting help (Replies: 2)

Loading...