Extracting data values from MATLAB meshgrid output -


i need extract data values particular coordinate meshgrid in matlab, code following:

paarx=paar(:,1); paarx1=paarx(1:20:length(paarx)); paary=paar(:,2); paary1=paary(1:20:length(paary)); x=paarx; y=paary; v=paar(:,3); [xi, yi]=meshgrid(paarx1, paary1); vq=griddata(x, y, v, xi, yi, 'cubic'); 

the paarx, paary , v x, y , z values of surface, z values values interpolated. paarx1 , paary1 values used in meshgrid every 20th value taken (the array large before this). need extract interpolated z values in vq particular x , y coordinates.

as understood question, need this:

nx = 3; % <= length(paarx1) ny = 4; % <= length(paary1) fprintf('the interpolated value @ x=%g , y=%g %g',paarx1(nx),paary1(ny),vq(ny,nx)) 

or can transpose matrix vq

vq = vq.'; fprintf('the interpolated value @ x=%g , y=%g %g',paarx1(nx),paary1(ny),vq(nx,ny)) 

vq(ny,nx) (y first) because use meshgrid function. can use access matrix element in form vq(nx,ny) (x first) ndgrid function (but i'm not sure works griddata).


Comments

Popular posts from this blog

elasticsearch python client - work with many nodes - how to work with sniffer -

angular - Is it possible to get native element for formControl? -

Upload file with tags through OwnCloud or NextCloud API -