expint not functioning as expected?

16 views (last 30 days)
J
J on 29 Mar 2011
Hi all,
I am trying to use expint in a routine I am coding, however it doesn't seem to be working as I expect it to. I expect it to function as shown by the link below
With the output starting negative then becoming positive around 0.372. Have I misunderstood what this function does?
I am using the command below to check output:
>> plot(expint(0:0.01:1.5))
Thanks,
J

Accepted Answer

Matt Fig
Matt Fig on 29 Mar 2011
I think perhaps you are looking for this:
Ei = @(x)real(-expint(-x));
x = -2:0.001:3;
plot(x,Ei(x))
  2 Comments
J
J on 29 Mar 2011
So effectively I was just assuming to see the real part of the answer? Just me being stupid again then...
Matt Fig
Matt Fig on 29 Mar 2011
You probably confused one definition of the exponential integral for the other. Read the doc for EXPINT carefully.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!