I getting an error (interp2 size). Can you help me ??

조회 수: 9 (최근 30일)
Erhan Ferdi
Erhan Ferdi 2014년 2월 23일
댓글: Erhan Ferdi 2014년 2월 23일
??? Error using ==> interp2 at 147 The lengths of X and Y must match the size of Z.
??? Error in ==> Untitled55 at 12 mesh (xi,yi,interp2 (x,y,A,xi,yi, 'linear'));
% Code here:
clc;
clear all
clf;
colormap ('JET');
A = [-10,5,10;0.2,1,2;1,6,2];%%%%
% I am sure, this error is here...I did not understand. How can I do?
x = (-10:.5:10);
y = [0.98391 0.99116 0.99551 1.00565 0.99406 0.97377 0.99406 0.98391 0.98681 0.96797....
0.95348 0.92884 0.89986 0.90565 0.93174 0.96652 1.02304 1.08681 1.14188 1.13029....
1.1042 1.09986 1.09261 1.07087 1.06942 1.05928 1.06507 1.06797 1.05203 1.05493....
1.05348 1.07522 1.06217 1.07667 1.05203 1.05058 1.05638 1.06797 1.04333];
xi = linspace (min (x), max (x), 39);
yi = linspace (min (y), max (y), 5);
mesh (xi,yi,interp2 (x,y,A,xi,yi, 'linear'));
[x,y] = meshgrid (x,y);
hold on; plot3 (x(:),y(:),A(:),'b*'); hold off;
  댓글 수: 3
Erhan Ferdi
Erhan Ferdi 2014년 2월 23일
help ?
Erhan Ferdi
Erhan Ferdi 2014년 2월 23일
help???

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

답변 (1개)

Dishant Arora
Dishant Arora 2014년 2월 23일
편집: Dishant Arora 2014년 2월 23일
A should have as many elements as length(x)*length(y) . A specifies values at those grid points.
  댓글 수: 1
Dishant Arora
Dishant Arora 2014년 2월 23일
Erhan, you should ask your query here in comment box. for example go throgh the documentation of interp2

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by