array exceeds maximum array size preference.

조회 수: 5 (최근 30일)
mohamed elkasemy
mohamed elkasemy 2019년 10월 4일
답변: Walter Roberson 2019년 10월 4일
clc;
clear all;
close all;
t = [0:10^20];
K = 1.38*10^-23;
Me = 9.11*10^-31;
T = 1.3543*10^3;
V = 100*sqrt(3*K*T*11600/Me);
Ne = 1.42*10^24;
Np = 1.42*10^24;
E = 10^6;
b = (7.56*10^-16)*(6.24*10^18)*((11600)^4)/((100)^3);
F = ((1.166*10^-23)^2);
Y = sqrt(T^2-((Ne*Np*E*V*F*((1.239*10^-4)^2)*t)/(2*b)));
plot(t, Y)

답변 (2개)

the cyclist
the cyclist 2019년 10월 4일
편집: the cyclist 2019년 10월 4일
In this line of code
t = [0:10^20];
You are trying to create a vector that is length 10^20.
That is ... uh ... big. If I did my quick math right, that's over a billion terabytes to store.

Walter Roberson
Walter Roberson 2019년 10월 4일
0:10^20 requests an array counting 0, 1, 2, 3, all the way to 10^20. That would take about 2^69 bytes to represent. However, no x64 architecture can access more than 2^64 bytes in theory, and no publically released x64 chip can access more than 2^48 bytes -- there are no address lines A48 to A63.
If you did manage to hack an x64 system to have 2^69 bytes of memory, then it would take rather a while to create the array. If you used a multi core system that could initialize 10^10 per second then it would take about 316 years.

카테고리

Help CenterFile Exchange에서 Neural Simulation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by