|
From: | Moo |
Subject: | Re: Octave too slow runnig some instruction |
Date: | Thu, 24 Jun 2010 23:46:16 +0200 |
function [h,times] = make_random_direction(n,N,sigma)
times = zeros(3,1);
x=zeros(N,1);
y=zeros(N,1);
tic
for i=1:N
x(i) = normrnd(0,sigma(i)*sigma(i),1,1);
y(i) = normrnd(0,sigma(i)*sigma(i),1,1);
end
times(1) = toc;
h = zeros(n,2);
tic
t = linspace(0,2*pi,n);
times(2) = toc;
tic
for i=1:n
for j=1:N
h(i,1) = h(i,1) + x(j)*cos(t(i)*j);
h(i,2) = h(i,2) + y(j)*sin(t(i)*j);
end
end
times(3) = toc;
end
Dear all,
I'm working on a program and I have wrote a quite simple m-file which
generates a random closed curve. I have runned it by octave versions 3.0.5,
3.2, 3.2.4 but always the same problem: too slow.
The executing time of Octave is 35 seconds, matlab's executing time is less
than 1 second!
Why?
The problem is that I will have running this functions thousands of times
into my program!
Can anyone help me?
Thank you very much.
--
View this message in context: http://octave.1599824.n4.nabble.com/Octave-too-slow-runnig-some-instruction-tp2266693p2266693.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |