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

??? 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 Kommentare

Jan
Jan am 23 Feb. 2014
Bearbeitet: Jan am 23 Feb. 2014
I've read this question today already. Did you delete the former question instead of editing it? If so, don't do this because it confuses the readers.
Erhan Ferdi
Erhan Ferdi am 23 Feb. 2014
help ?
Erhan Ferdi
Erhan Ferdi am 23 Feb. 2014
help???

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Dishant Arora
Dishant Arora am 23 Feb. 2014
Bearbeitet: Dishant Arora am 23 Feb. 2014

0 Stimmen

A should have as many elements as length(x)*length(y) . A specifies values at those grid points.

1 Kommentar

Erhan, you should ask your query here in comment box. for example go throgh the documentation of interp2

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interpolation finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 23 Feb. 2014

Kommentiert:

am 23 Feb. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by