I am having a problem with MATLAB regarding RAM usage. I am trying to run a function (code below) and every time I plot the function using surf my RAM usage spikes up to an absurd amount causing the system to write to the hard drive drastically slowing down system performance. My questions is if there is anyway I can reduce the RAM usage. I am new to MATLAB so if the answer is obvious I apologize for my ignorance. I am running MATLAB 2014a on Mac OS X with 16gb of 1600Mz DDR3 Memory.
x=randn(1,10000);a=sort(x);y=x;b=sort(y);[X,Y]=meshgrid(a,b);z=(1000/sqrt(2*pi).*exp(-(X.^2/2)-(Y.^2/2)));subplot(2,2,1)surf(X,Y,z);shading interpaxis tightcolormap coolsubplot(2,2,2)surf(X,Y,z);shading interp
Thanks in advance for the help.
Best Answer