help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with plotting of functions for large arguments


From: Przemek Klosowski
Subject: Re: Problem with plotting of functions for large arguments
Date: Fri, 30 Oct 2015 10:55:44 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/30/2015 05:09 AM, kschnikow wrote:
Dear all,

I have a problem using the plot() functions for e.g. plotting the sine
function for large arguments  > 1e6

For example, when I define the intervall x=10000000*pi:4*pi/100/10000004*pi;
and I try to plot(x,sin(x)) I get rubbish.
The interval above must be a typo: you probably meant to say
x=10000000*pi:4*pi/100:10000004*pi

Now, it's true that the resulting plot(x,sin(x)) is wrong. The values are actually correct, as shown by plotting them as points by plot(x,sin(x),'.').

This is because the default graphics toolkit, fltk, has issues with plotting large magnitude numbers because uses single precision floating point internally. Most Octave installs will have two graphics toolkits available: fltk and gnuplot, and gnuplot does not have this problem, so switch to it and the plot will come out fine:

graphics_toolkit ('gnuplot')
 plot(x,sin(x))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]