% PX = PermuteSystems(X,PERM,DIM,ROW_ONLY,INV_PERM) permutes the order of % DIM (default has all subsystems of equal dimension) % This function has three optional arguments: % where each subsystem is assumed to have equal dimension % of the vector or matrix X according to the permutation vector PERM, % PX = PermuteSystems(X,PERM) permutes the order of the subsystems % This function has two required arguments: We do the first call of permute to do this, then another permute call to undo our permutation and get the original dimensions back.%% PERMUTESYSTEMS Permutes subsystems within a state or operator As such, if we had a slice at z = 1 and one at z = 2, if we wanted to find what the 2D grid of values was at slice z = 1.5, this will generate a 2D slice that creates these interpolated values using information between z = 1 and z = 2. What this will do is that for each value of z, we will generate a 2D slice of values. The key method to interpolate in 3D is the permute method. MFinal would be your final interpolated / resized 3D matrix. %//If the number of output slices don't match after we interpolate in 3D, we MFinal = permute(interp1(z,permute(M2D,),zi),) M2D = zeros(outputSize(1), outputSize(2), d(3)) %//This is due to round off when perform 1/scaleCoeff(2) or %//by doing meshgrid, we don't get exactly the output size we want %//We simply duplicate the last rows and last columns of the grid if %//Create gridded interpolated co-ordinates for 1 slice Without further ado, here is the code to do this: %// Specify output size of your matrix here After, use interp1 and permute to resize the third dimension.For each 2D slice in your matrix, use interp2 to resize each slice to the output rows and columns using the above 2D grid.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |