Re: quad function



John D'Errico wrote:
>
>
> In article <dp2tfu$lqa$1@xxxxxxxxxxxx>, Markus
<no@xxxxxxxxx>
> wrote:
>
>> Simon wrote:
>> > PB wrote:
>> >>
>> >> Simon wrote:
>> >>>
>> >>> Hi, I am a new user of MATLAB.
>> >>> I found out that some functions can't be
integrated using the
>> >>> quad/quadl syntax. Is it a limitation or else I
wrongly used
>> > it?
>> >>> I have to make use of Simpson's rule to solve
those
> functions.
>> >>>
>> >>> Thanks
>> >> Please post examples of the functions that you can´t
> integrate.
>> >>
>> >> /PB
>> >
>> > For example, f(x)=exp((-x^2./2)+tan(x)).
>>
>> It depends on your interval of integration because
>> tan(x) has singularities.
>
> Of course, Simpson's rule has the same issues with
> those singularities.
>
> Why do you say quad cannot integrate this function?
>
> f=@(x) exp((-x.^2/2)+tan(x));
> quad(f,0,1)
>
> ans =
> 1.6284
>
>
> Is it because you unnecessarily used ./ to divide by 2,
> but failed to use .^ to square x?
>
> HTH,
> John D'Errico
>
>
> --
> The best material model of a cat is another, or preferably the
> same, cat.
> A. Rosenblueth, Philosophy of Science, 1945
>
> Those who can't laugh at themselves leave the job to others.
> Anonymous
>
Thx a lot.
But I just found out that there are two methods for which I can
perform integration(quad and quadl). Which one is better?
For many functions, they just return the same answer.
.



Relevant Pages

  • Re: A Quasi Indefinite Integral
    ... John D'Errico wrote: ... >> So what I want after the integration, ... > preferably the same, cat. ... > A. Rosenblueth, Philosophy of Science, 1945 ...
    (comp.soft-sys.matlab)
  • Re: quad function
    ... > Simon wrote: ... > It depends on your interval of integration because ... > tanhas singularities. ... The best material model of a cat is another, or preferably the same, cat. ...
    (comp.soft-sys.matlab)
  • Re: OT: losing a pet
    ... > John said: it's really hard...sometimes I feel like going down. ... When my 22 year old cat Mug died, several years ago, I posted the ... The fact that Paul has had many pet dogs, and John many pet cats, ...
    (rec.music.beatles)
  • Re: Draw triangle around scatter data
    ... Many thanks John for the tip.. ... I don't think I need that advanced algorithm but I was ... shared in matlab central file exchange? ... The best material model of a cat is another, or preferably the same, cat. ...
    (comp.soft-sys.matlab)
  • Re: Platitudes from a Platypus
    ... I fancy my posts ... So John decided to leave his cat with his best friend, ... "How's Mom?" ...
    (uk.people.silversurfers)

Loading