help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Confused by Integration


From: Jason C. Wells
Subject: Confused by Integration
Date: Sun, 14 Aug 2011 15:27:23 -0700
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20110120 Lightning/1.0b2 Thunderbird/3.1.7

I am confused by integration. I see that the various quad function take different types (scalar, vector) and give different outputs. I've been trying them out and watching how the quadrature behaves for each of them. E.g:

        function retval = integrand (x)
            x
            retval = x .^ 2
        endfunction

        # integral = quadv ("integrand", -Inf, Inf)

        a = -10: 1: 10;
        integral = quadgk ("integrand", a(1), a(end))

Quadgk seems close to what I want, but the variable of integration "bounces around" which makes plotting impossible.

x=
      -9.999989
      -9.435377
      -7.911791
      -5.669229
      -2.947694
       0.012817
       2.972302
       5.690762
       7.928196

Ultimately I'd like to make a plot of the integral. It seems that all of the quadrature functions do not pay attention to the the range i've given. The functions do their own thing within the limits of integration.

Does a person need to run the integration, then re-sort and re-interpolate in order to produce outputs at evenly spaced inputs?

How do I integrate such that each output value corresponds with an input value taken from a range of from a linspace vector?

Thanks in advance,
Jason C. Wells


reply via email to

[Prev in Thread] Current Thread [Next in Thread]