This question is closed. Reopen it to edit or answer.

Data exceed the computer memory

3 views (last 30 days)
Wiqas Ahmad
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
FOV_e = 0; %¼¤¹âÆ÷·¢É¢½Ç£¨rad£©DIV of laser
t = 0; %¼¤¹âÆ÷Âö¿í£¨s£©
FOV_r = 0.002; %ÍûÔ¶¾µ½ÓÊÕÊÓ³¡½Ç£¨rad£©FOV of receiver
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

Answers (1)

Mathieu NOE
Mathieu NOE on 20 Oct 2020
why not simply do a moving average of your data ?
help movmean


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!