I just started learning Matlab again after not having used it in months, and got some odd results -
Trying to plot tan(x), from -pi/2 to pi/2 -
I ended up getting something that has a negative spike at 0 and positive spike at 100. Certainly doesn't look like tan(x) to me.Code:X = (-pi/2):pi/100:(pi/2); for i = 1:length(X) Y(i) = tan(X(i)); end; plot(Y);
I'm sure it's something simple, but it's been an hour already...
Ah! Ok. It seems like the big dynamic range threw Matlab off somehow. Adding clamping works.