Why are points are missing in my log log plot?

3 Ansichten (letzte 30 Tage)
Bethany
Bethany am 9 Sep. 2013
I am trying to plot a log log plot and some of my points wont show up on the plot. My code is below:
i=-20:-1; %generate list of exponents
h=10.^i; %generate list of different h's using exponents
x0=1.2; %set x0
f=sin(x0); %calculate f(x0)
f1=cos(x0); %calculate f'(x0)
f2=-sin(x0); %calculate f''(x0)
approx=(2*cos((2*x0+h)/2).*sin(h/2))./h;%calculate the approximation of f'(x0)
err=abs(f1-approx);%calculate the error
d_err=h/2*abs(f2); %estimate the discrete error
loglog(h,err,'m*-');
hold on;
loglog(h,d_err,'g-.');
axis([10^(-20) 1 10^(-35) 100])
For some reason the points between 10^-15 and 10^-20 don't show up

Antworten (2)

Amit Nambiar
Amit Nambiar am 9 Sep. 2013
Bearbeitet: Amit Nambiar am 9 Sep. 2013
I don't have a specific answer to this question. But I think, when you find out the log of a particular series, you are in a way 'compressing' the range of the series(Of course it depends on the base and all other factors).
for eg: numbers x=10 to 1000 with y=log(10)x will give you numbers a range 1 to 100 and loglog(i.e z=log(10)y ) will give you numbers in a range 0 to 10 and so on...
My point is that 1)loglog of small numbers will give you even smaller numbers. 2)Log of numbers less than your base will give you negative numbers and log of negative numbers is not defined. That might be the reason why you are not getting a plot for those particular values, those values lesser than your base of log that you are using in your code. Did the compiler show some sort of error?

Walter Roberson
Walter Roberson am 9 Sep. 2013
Your endpoint is 1. eps(1) is about 10^(-15). The internal axis calculation gives out when you want resolution finer than eps() of your maximum value.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by