Info

# Data exceed the computer memory

1 view (last 30 days)
Wiqas Ahmad on 20 Oct 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, I have obtained these curves from the mentioned program. I'd like to make the blue curve more smoother which can be done by increasing the power of parameter "num" as shown in the program. However increasing the value of "num" from certain limit causes the data to exceed the computer memory making matlab unable to run the data and shows the following error. How to cope with this problem?
%%ÀûÓÃÃÉÌØ¿¨Âå·½·¨¼ÆËã¹â×Ó¶à´ÎÉ¢Éä»Ø²¨µÄ³ÌÐò MC for the water cloud
%%here I use semi-analytical MC to promote efficiency
%% Ïàº¯Êý Phase function
load data.mat; %% file containing the data of T and PHF.
T = data(1,:); %¶ÁÈ¡½Ç¶È scattering angle,0:x:180,x is angular resolution
PHF = data(2,:); %¶ÁÈ¡Ïàº¯Êý phase function corresponding to scattering angle T
I1 = cumtrapz(T,PHF.*sin(T))/2;%cumtrapz used for cumulative integration,normalized probability density
I1 = I1/max(I1);
%% ²ÎÊý³õÊ¼»¯ºÍ¾ØÕóÔ¤·ÖÅä Parameters
t = 0; %¼¤¹âÆ÷Âö¿í£¨s£©
R = 0.1; %ÍûÔ¶¾µ½ÓÊÕ°ë¾¶(m) radius of receiver
H = 300; %ÔÆ²ãºñ¶È(m) depth of cloud
D = 1002; %ÔÆµ×¸ß¶È(m) base height of cloud
a = 0.01725; %Ïû¹âÏµÊý(1/m) extinction
w0 = 1; %È¨ÖØÏµÊý for water cloud no absorption, so w keeps 1, you can improve it to suit media which has absorption
num =10^8; %¼ÆËãµÄ×Ü¹â×ÓÊý total photon number
max_order = 7; %×î´óÉ¢Éä´ÎÊý maximum scattering order % scattering events are related to the penetration depth of the cloiuds and thats why limited
S = zeros(num,10); %µ¥¹â×Ó»Ø²¨ÐÅºÅ´æ´¢¾ØÕó to store recevied signal(in fact,it is recevied photon number)
P = zeros(num,10); %µ¥¹â×ÓÓÎ×ßÂ·¾¶´æ´¢¾ØÕó to store photon path
alt_r= 1002:6:1302; %the layers of the cloud
%here I store the signal and path of every photon, you can improve to store
%singnal of different cloud layer to save the size of S and P by judge the path of the photon,like S_sig
%if not,when the photon number is large will out of cumputer memory
S_sig = zeros(length(alt_r),max_order);% signals of different layers and scattering orders
----------------------------------------------------------------------------------------------------------------
Error in zk_mc (line 20)
S = zeros(num,100); %µ¥¹â×Ó»Ø²¨ÐÅºÅ´æ´¢¾ØÕó to store recevied signal(in fact,it is recevied photon number)
>> zk_mc
Requested 100000000x11 (8.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a
long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in zk_mc (line 53)
P(i,j) = PPL+D+sqrt(x*x+y*y+(z+D)*(z+D)); %µ¥¹â×Ó»Ø²¨ÓÎ×ß×ÜÂ·¾¶
total path Mathieu NOE on 20 Oct 2020
hi
why not simply do a moving average of your data ?
help movmean
https://www.mathworks.com/help/matlab/ref/movmean.html