help-octave
[Top][All Lists]

## I NEED HELP: Differences between MATLAB and Octave

 From: Marco Boni Subject: I NEED HELP: Differences between MATLAB and Octave Date: Fri, 7 Jun 2002 14:25:17 -0500

The simple code I've attached to this mail runs very fast under Matlab, while it is executed very slow under Octave.

Why? Where I've failed!

```--
Marco Boni
Viale delle Magnolie, 4
50142 - Firenze
Cell.: +39 335 6079353
Home : +39 055 7398033
-----------------------------------------------------
My machine is an i686 and running Red Hat Linux 7.2
Why don't you try it?
-----------------------------------------------------```

```%entropia di un segnale random

closeplot;
clear all;
k=16;
nt=2^k;
a=floor(rand(1,nt)+.5);
dt=k+4;
for n=1:dt
dimb=n;
numb=floor(nt/dimb);
dim=dimb*numb;
aa=reshape(a(1:dim),dimb,numb);
x=(1:1:n)-1;
xx=2.^x;
ris1=xx*aa+1;
ris2=hist(ris1,2^n);
ris3=ris2(find(ris2));
%
size(ris3,2)/size(ris2,2);
n
p=ris3/numb;
ris(n)=-sum(p.*log(p));
end;
entr=diff(ris);
entr(1)=log(2);
plot(entr);hold;plot(entr,'*');
plot(log(2)*ones(1,dt),'r');grid
input ("Pick a number, any number! ")
```