MATLAB: Expint not functioning as expected

expint

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

Best Answer

I think perhaps you are looking for this:
Ei = @(x)real(-expint(-x));
x = -2:0.001:3;
plot(x,Ei(x))