Plotting Problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Plotting Problem

Thomas D. Dean-2
GNU Octave, version 4.3.0+
Up-to-date with hg  as of today.

I found this following a matlab application

octave:6> size(f)
ans =

    131073        1
octave:9> plot(f)
error: set: "cameratarget" must be finite
error: called from
     delete at line 60 column 5
     newplot at line 202 column 11
     plot at line 222 column 9
          line 2: x range must be greater than 0 for log scale

octave:10> plot([1:131073])
error: set: "cameratarget" must be finite
error: called from
     delete at line 60 column 5
     newplot at line 202 column 11
     plot at line 222 column 9
          line 6: x range must be greater than 0 for log scale

Is this a known problem?

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Dmitri A. Sergatskov


On Sat, Aug 26, 2017 at 4:03 PM, Thomas D. Dean <[hidden email]> wrote:
GNU Octave, version 4.3.0+
Up-to-date with hg  as of today.

I found this following a matlab application

octave:6> size(f)
ans =

   131073        1
octave:9> plot(f)
error: set: "cameratarget" must be finite
error: called from
    delete at line 60 column 5
    newplot at line 202 column 11
    plot at line 222 column 9
         line 2: x range must be greater than 0 for log scale

octave:10> plot([1:131073])
error: set: "cameratarget" must be finite
error: called from
    delete at line 60 column 5
    newplot at line 202 column 11
    plot at line 222 column 9
         line 6: x range must be greater than 0 for log scale

Is this a known problem?

​Works for me.​
9c97909a6c94 tip @
​tried all 3 graphics backends.

​It is probably something you did before the plot().
Do you get the same error if you just do
​ plot([1:131073]) in a freshly restarted octave?


 

Tom Dean


​Dmitri.
--


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Thomas D. Dean-2
On 08/26/2017 02:09 PM, Dmitri A. Sergatskov wrote:

> ​It is probably something you did before the plot().
> Do you get the same error if you just do
> ​ plot([1:131073]) in a freshly restarted octave?
>
>
>
>     Tom Dean
>
>
> ​Dmitri.
> --
> ​
>
I attached the script.  It is from a paper:

How to use the FFT and Matlab’s pwelch function
for signal and noise simulations and measurements

Here is the top part of the script down to the first warning.

GNU Octave, version 4.3.0+
Copyright (C) 2016 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> pkg load signal
octave:2> ##
octave:2> TSamp = 1e-6;
octave:3> t = (0:TSamp:2^21*TSamp)';
octave:4> fsig = 440.55;
octave:5> ## Constructed to show some scallop loss
octave:5> asig = 0.8;
octave:6> ## Signal magnitude in V
octave:6> vn = 1/300;
octave:7> ## Total integrated noise in Vrms
octave:7> vin = asig*sin(2*pi*fsig*t)+randn(size(t))*vn;
octave:8> bout = ones(size(vin));
octave:9> qin = 0;
octave:10> regin = vin(1);
octave:11> regout = 0;
octave:12> for k=2:max(size(t));
 >   if qin>=0
 >     qout=1;
 >   else
 >     qout=-1;
 >   endif
 >   bout(k)=qout;
 >   qin = regin;
 >   regin = vin(k)-qout+qin;
 > endfor
octave:13> ## Calculate an 8-times averaged spectrum with pwelch
octave:13> nx = max(size(bout));
octave:14> na = 8;
octave:15> w = blackmanharris(floor(nx/na));
octave:16> [Pxx,f] = pwelch(bout,w,0,[],1/TSamp);
octave:17> ## Calculate the spectrum parameters
octave:17> fbin = f(2)-f(1);
octave:18>
octave:18> CG = sum(w)/(nx/na);
octave:19> NG = sum(w.^2)/(nx/na);
octave:20>
octave:20> ## Calculate the indices of the Signal, harmonics, band edge
octave:20> isig = round(fsig/fbin)+1;
octave:21> ih3 = round(3*fsig/fbin)+1;
octave:22> ih5 = round(5*fsig/fbin)+1;
octave:23> ibw = round(2500/fbin)+1;
octave:24>
octave:24> ## Plot and mark the above
octave:24> printf("Before loglog(f,Pxx)\n")
Before loglog(f,Pxx)
octave:25> printf("Size f:   %d\n", max(size(f)))
Size f:   131073
octave:26> printf("Size Pxx: %d\n", max(size(Pxx)))
Size Pxx: 131073
octave:27> loglog(f,Pxx);
warning: axis: omitting non-positive data in log plot
warning: called from
     __line__ at line 120 column 16
     line at line 56 column 8
     __plt__>__plt2vv__ at line 502 column 10
     __plt__>__plt2__ at line 248 column 14
     __plt__ at line 113 column 17
     loglog at line 60 column 10

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

fft_noise_meas.m (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Dmitri A. Sergatskov
On Sat, Aug 26, 2017 at 6:43 PM, Thomas D. Dean <[hidden email]> wrote:

octave:27> loglog(f,Pxx);
warning: axis: omitting non-positive data in log plot
warning: called from
    __line__ at line 120 column 16
    line at line 56 column 8
    __plt__>__plt2vv__ at line 502 column 10
    __plt__>__plt2__ at line 248 column 14
    __plt__ at line 113 column 17
    loglog at line 60 column 10


​This warning is benign -- it's a long-stanging buglet in signal package (which I thought
was fixed some time ago, but apparently reappears again):
the spectral power ​must be positive, but due to finite numerical precision one could get
it negative.

​I can reproduce ​
error: set: "cameratarget" must be finite
​(which is serious)
but I have not figure out where it is coming from. ​
​Perhaps you should file a bug report.​

​Dmitri.
​--


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Dmitri A. Sergatskov


On Sat, Aug 26, 2017 at 7:35 PM, Dmitri A. Sergatskov <[hidden email]> wrote:
On Sat, Aug 26, 2017 at 6:43 PM, Thomas D. Dean <[hidden email]> wrote:

octave:27> loglog(f,Pxx);
warning: axis: omitting non-positive data in log plot
warning: called from
    __line__ at line 120 column 16
    line at line 56 column 8
    __plt__>__plt2vv__ at line 502 column 10
    __plt__>__plt2__ at line 248 column 14
    __plt__ at line 113 column 17
    loglog at line 60 column 10


​This warning is benign -- it's a long-stanging buglet in signal package (which I thought
was fixed some time ago, but apparently reappears again):
the spectral power ​must be positive, but due to finite numerical precision one could get
it negative.


​So I was wrong -- the problem is that f starts at 0 and you cannot plot that in loglog ​plot.
The loglog() function is trying to do something clever about it, but that messes up some
plot properties.
You can get rid of this problem for now by setting f(1) to some small value (<< f(2)).


​Dmitri.
--


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Dmitri A. Sergatskov
​A simple test to reproduce the problem:

octave:1> loglog((-1:1),1)
error: out of memory or dimension too large for Octave's index type
error: called from
    __line__ at line 120 column 16
    line at line 56 column 8
    __plt__>__plt2vs__ at line 468 column 15
    __plt__>__plt2__ at line 246 column 14
    __plt__ at line 113 column 17
    loglog at line 60 column 10
octave:1> loglog((-1:1),1)
error: set: "cameratarget" must be finite
error: called from
    delete at line 60 column 5
    newplot at line 202 column 11
    loglog at line 53 column 9

​I will file a bug report.

Dmitri.
--


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Plotting Problem

Thomas D. Dean-2
On 08/26/2017 07:07 PM, Dmitri A. Sergatskov wrote:

> ​A simple test to reproduce the problem:
>
> ​
> octave:1> loglog((-1:1),1)
> error: out of memory or dimension too large for Octave's index type
> error: called from
>      __line__ at line 120 column 16
>      line at line 56 column 8
>      __plt__>__plt2vs__ at line 468 column 15
>      __plt__>__plt2__ at line 246 column 14
>      __plt__ at line 113 column 17
>      loglog at line 60 column 10
> octave:1> loglog((-1:1),1)
> error: set: "cameratarget" must be finite
> error: called from
>      delete at line 60 column 5
>      newplot at line 202 column 11
>      loglog at line 53 column 9
>
> ​I will file a bug report.
>
> Dmitri.
> --
> ​
>

Thank you.

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave