"Ozan" wrote in message <jk4vbi$5ao$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I couldn't find the reason of getting "The integrand function must return an output vector of the same length as the input vector." error while trying to compute integral. Below you will find my code:
> My function 'part1' that computes the integrand:
>
> function y = part1(cheb_epsilon);
> y=diff(cheb_epsilon).*diff(cheb_epsilon);
>
> Than I handle my function to quad, along with the limits of integration, 1 to 1:
>
> Q=quad(@part1,1,1)
>
> After I run the code I get the following error
> "??? Error using ==> quad at 80
> The integrand function must return an output
> vector of the same length as the input vector."
>
> Could anyone tell me how can I handle this error?
>
> Thanks
      
I should also have pointed out that returning squares of difference values to 'quad' using 'diff' does not represent any kind of sensible integrand in the integration process. Even if it did somehow accept a reduced number of returned values, there is no way it could ever compute a valid integral from this. What would it be the integral of  the square of a derivative, but the derivative of what?
Roger Stafford
