Re: How to find the area of 2 polynomials?



mango wrote:


I'm working out a matlab function recently, i came across a
difficulty to find the area of 2 different polynomials. For
example:
x=[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
y=[-0.447 1.978 3.28 6.16 7.08 7.34 7.66 9.56 9.48 9.30 11.2];
p = polyfit(x,y,2);
z = polyval(p,x);
plot(x,y,'r-',x,z,'b')

%how to find the area at the intersection of the 2polynomials? I
mean
the area bounded by 2curves(the polyfit curve and the original
curve). Thanks.

I assume that you intend to find the
integral of the absolute value of the
difference between the two?

Simplest is to interpolate both curves
at many points, and use trapz on the
result. Interpolate the original data
with interp1 using the 'linear' method.
Evaluate the polynomial using polyval.

This will not be exact, but reasonably
close if you take enough points. If you
want the exact solution, it is not too
hard, but probably not worth the effort.

HTH,
John D'Errico
.



Relevant Pages

  • Re: How to find the area of 2 polynomials?
    ... difficulty to find the area of 2 different polynomials. ... the area bounded by 2curves(the polyfit curve and the original ... Simplest is to interpolate both curves ... absolute value of the difference. ...
    (comp.soft-sys.matlab)
  • Re: How to find the area of 2 polynomials?
    ... John D'Errico wrote: ... difficulty to find the area of 2 different polynomials. ... the area bounded by 2curves(the polyfit curve and the original ... Simplest is to interpolate both curves ...
    (comp.soft-sys.matlab)
  • Re: Origin of Chinese spoken languages
    ... >> polynomials are only useful for the points between data points. ... If the interpolating polynomial curve is fitted using the data ... >> the dates for total numbers of characters used is interesting, ... >> paucity of such inscriptions, in the hundreds of bronzes rather than ...
    (sci.lang)
  • Re: help solving polynomial equation used in wavelet design
    ... degree m and a curve of degree n intersect in mn ... y^p imply that there exist polynomials fand g ... Daubechies wavelet design imposes an additional approximation ... it may be possible to prove it using the extended Euclidean Algorithm. ...
    (sci.math)
  • Re: Some newbie ECC questions: base point, cofactor, multiplicative inverse, and more!
    ... get a set of point which is the "subgroup generated by P". ... generated such that the curve order is either prime or a small multiple ... algorithms, usually complex, slow and/or patented. ... elements are polynomials ...
    (sci.crypt)