PDA

View Full Version : Help with Matlab Question


xpack
10 Sep 2009, 1:35pm
Show that the limit as x approaches 0 (e^x - 1) / x = 1

Do this by first creating a vector x that has some elements: 1 .5 .1 .01 .001 .00001 .0000001. Then create a new vector y in which each element is determined from the elements of x by (e^x - 1)/x . Compare the elements of y with the value 1 (use format long to display the numbers)


I put this in

x = [ 1 .5 .1 .01 .001 .0001 .0000001 ]
y = (exp(x)-1)/(x)

But it only returns when x= 1

I'm new to Matlab

Myrmidon
10 Sep 2009, 3:43pm
When using matrix math, you need to use matrix operators.

The / sign is a linear operator. Try using ./ instead of /

xpack
10 Sep 2009, 4:53pm
Thank you, ugh, always have problems with small things like that. Thank you!