maximum variable size allowed by the program is exceeded?
이전 댓글 표시
PLz help me
This is the code
alps=17; %slope angle
dz=200; %depth of water table from the suface
dlz=400; % toltal depth of slope
fi=25; %friction angle
C=0.4; %4 kpa=0.4 N/cm^2
gsat=0.21; %21 kN/m^3
gw=0.098; %9.81 Kn/m^3
Dzero=4; %0.0004m^2/s
ksat=1e-3; %e-5 m/s
iz=2e-4; %iz=7.2 mm/h= 2e-4 cm/s
deltat=10; %time step
deltaz=0.8; %space step
T=12*60*60; %time duration of rainfall= 12h to seconds
e=(deltat/deltaz^2)*Dzero*cos(17*pi/180)*cos(17*pi/180);
n=500; %time step, based on T
%Setup sparse matrix
b= sparse(1:n,1:n,-116.314,n,n); % element b... 1...n
c= sparse(1:n-1,2:n,e,n,n); % element c...
a= sparse(2:n,1:n-1,-e,n,n); % element a... 2...n-1
c(1)=114.314; a(1)=0; a(n)=114.314; %Boundary condition
A= a+b+c;
l=e*ones(1:n); m=112.314*ones(1:n); u=e*ones(1:n);
and This is the error below, please tell me why this error appears and how to solve. My system is 64 bit and 6gb ram and processor speed is 2.5 Ghz Error using ones Maximum variable size allowed by the program is exceeded.
Error in hillslopesparse (line 30)
l=e*ones(1:n); m=112.314*ones(1:n); u=e*ones(1:n);
채택된 답변
추가 답변 (2개)
Guillaume
2014년 9월 1일
If you meant to create a matrix of ones of size n*n then the proper syntax is:
ones(n); %or ones(n, n);
As it is you're attempting to create a 500-d matrix with 1st dimension of size 1, 2nd dimension of size 2, ..., 500th dimension of size 500!
댓글 수: 2
Guillaume
2014년 9월 1일
Also, as an aside you can use
cosd(17);
instead of
cos(17*pi/180);
advaita vedanta
2014년 9월 2일
카테고리
도움말 센터 및 File Exchange에서 Coordinate Reference Systems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!