how to reduse the size of an array for meshgrid

조회 수: 4 (최근 30일)
Kafayat Olayinka
Kafayat Olayinka 2020년 2월 20일
댓글: Kafayat Olayinka 2020년 2월 21일
I have dataset of x,y,z
x=[1:13670];
y=[1:13670];
when i meshgrid x and y,
[X,Y]=meshgrid(x,y);
I recieved the following error:
Error using repmat
Requested 135670x135670 (137.1GB) 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.
how can i solve this problem?
Do I need to do some iteration? if so, how?
what will Z look like? will it be,
Z=z(X,Y);
  댓글 수: 11
Walter Roberson
Walter Roberson 2020년 2월 21일
You have vectors of length 135670 that have integer x values 1 to 12, and corresponding y values over 200, and corresponding z values?
You should be using scatteredInterpolant()
Kafayat Olayinka
Kafayat Olayinka 2020년 2월 21일
imagesc(x,y,z) did not work for me. I might have to meshgrid(x,y) first.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 21일
N = 100;
F = scatteredInterpolant(x, y, z);
xvals = min(x):max(x);
yvals = linspace(min(y), max(y), N);
[X,Y] = meshgrid(xvals, yvals);
Z = F(X, Y);
contour(X, Y, Z)
  댓글 수: 1
Kafayat Olayinka
Kafayat Olayinka 2020년 2월 21일
i used contourf(X,Y,Z) instead and it worked!! thanks alot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by