[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Running out of memory???
From: |
babelproofreader |
Subject: |
Running out of memory??? |
Date: |
Thu, 21 Jan 2010 09:05:49 -0800 (PST) |
Can anyone explain why the script below is failing with error message
error: memory exhausted or requested size too large for range of Octave's
index type -- trying to return to prompt
the script :-
clear
r2_critical_values_5=load("-ascii","r2_critical_values_5");
period = input( "Enter period length for sinewave: " );
sine_amp = input( "Enter sine amplitude: " );
trend_inc = input( "Enter incremental trend change: " );
sinevector=zeros(500,1)';
trendvector=zeros(500,1)';
for ii =2:500
sinevector(ii)=sinevector(ii-1)+(360/period);
trendvector(ii)=trendvector(ii-1)+trend_inc;
endfor
original_sine=sine_amp*(sin(sinevector.*(pi/180)));
trend_plus_sine=trendvector.+original_sine;
x = zeros(1:period)';
ydep = zeros(1:period)';
axis = (1:500)';
slope = zeros(1:500)';
r2 = zeros(1:500)';
sig_slope = zeros(1:500)';
for i=period:500
ydep=trend_plus_sine(i-(period-1):i,1)
[p,s]=polyfit(x,ydep,1);
slope(i,1)=p(1);
info=struct2cell(s);
sse=(cell2mat(info(5)))^2;
sst=sum((ydep.-mean(ydep)).*(ydep.-mean(ydep)));
r2(i,1)=(sst-sse)/sst;
if r2(i,1)>r2_critical_values_5(period)
sig_slope(i,1)=1;
endif
endfor
A=[axis,trend_plus_sine,slope,r2,sig_slope];
dlmwrite("calcs_output",A)
I can't believe that any of the arrays created exceed 2 GB of memory, or
that the memory on my computer is so limited that the script won't run - if
I had such limited memory my computer would be grindingly slow, which it
isn't?
--
View this message in context:
http://old.nabble.com/Running-out-of-memory----tp27261145p27261145.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Running out of memory???,
babelproofreader <=