简体   繁体   中英

Matlab 3D interpolation

I have 3 matrices(129x129) corresponding to x, y and z coordinates. I used the function mesh

mesh(x,y,z);

to plot the corresponding figure. It comes out to be a sphere. Now, I have another set of x, y, z(again 129) which gives a different sphere. What I want is to use interpolation in MATLAB to obtain the figures that come in between. I looked at the function interp3 in MATLAB but could not figure out what to do with it.

It seems like you are interested in the evolution of the surface z(x,y) from one surface z0 to another z1 . I would suggest the following process

 T = 5; % number of "time steps" from z0 to z1
 t = linspace( 0, 1, T );
 for ii = 1 : T
     zt = t(ii).*z1 + (1-t(ii)).*z0;
     mesh( x, y, zt ); title( sprintf( 'time %d', ii ) );
     drawnow;
     pause(1); wait a sec
 end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM