Ältere Kommentare anzeigen
I have a 3D surfrace plotted but it is quite rough and I need to smooth it out. I have tried using interpt2 and I keep recieving error codes.
below is the code I have been trying
x=0:21;
y=0:17;
[x,y]=meshgrid(x,y);
z=[-5 -5 0 0 0 0 0 0 0 -5 -5 -5 -5 -5 -5 -5 -5 -5 -5 -5 -5;0 0 5 0 1 0 2 0 0 1 0 -5 -5 -5 -5 -5 -5 -5 -5 -5 -5; 0 2 0 1 0 0 0 1 0 0 2 0 3 0 0 1 -5 -5 -5 -5 -5;0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 -5 -5 -5 -5;-5 -5 0 2 0 0 0 0 13 0 0 0 0 0 0 0 0 0 -5 -5 -5;-5 -5 0 0 0 0 0 0 0 0 0 0 24 0 0 0 0 0 0 -5 -5;-5 -5 -5 0 0 0 0 0 0 1 0 0 24 24 0 0 0 0 0 0 -5;-5 -5 -5 -5 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0;-5 -5 -5 -5 -5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -5 -5;-5 -5 -5 -5 -5 0 0 0 2 0 0 0 0 0 0 0 0 0 -5 -5 -5;-5 -5 -5 -5 -5 -5 0 0 0 0 0 0 0 0 0 0 1 0 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 0 3 0 0 0 0 0 23 0 0 -5 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 -5 0 0 0 0 0 27 27 0 -5 -5 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 -5 0 0 0 0 0 0 0 -5 -5 -5 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 -5 -5 0 0 0 0 -5 -5 -5 -5 -5 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 -5 -5 0 0 0 -5 -5 -5 -5 -5 -5 -5 -5 -5;-5 -5 -5 -5 -5 -5 -5 -5 -5 -5 0 -5 -5 -5 -5 -5 -5 -5 -5 -5 -5];
surf(z)
xlabel('Width')
ylabel('Length')
zlabel('Number of Earthquakes')
xi=0:.1:10;
yi=0:.1:10;
[xi,yi]=meshgrid(xi,yi);
zc=interp2(x,y,z,xi,yi,'cubic');
surf(xi,yi,zc)
These are the errors that keep popping up
Error using griddedInterpolant
GridVectors must define a grid whose size is
compatible with the Values array.
Error in interp2>makegriddedinterp (line 226)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 134)
F = makegriddedinterp(X, Y, V, method,extrap);
Error in MultiVaribleProject (line 12)
zc=interp2(x,y,z,xi,yi,'cubic');
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Seismology finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


