Matlab, interpolate non-square matrix keeping aspect-ratio -


i have matrix dimension 27x4, want interpolate matrix , plot same aspect ratio. i've been using interp2 since fills in values in between existing ones after each step matrix grows in both dimension 2*n-1, results in height growing faster width.

is there method interpolate matrix filling new matrix interpolated values without original ones, 1 both dimensions doubled?

the method think of, interpolate interp2 higher degree , pick out values, highly inefficient.

interp2 should work fine, must how define last 2 parameter. try this:

z = rand(4,27); x = 1:27; y = 1:4; [x, y] = meshgrid(x, y)  xi = linspace(1, 27, 1000); yi = linspace(1, 4, 1000 * (4/27)); % 4/27 here ensures keep aspect ratio [xi, yi] = meshgrid(xi, yi);  zi = interp2(x,y,z,xi,yi); 

check aspect ratios

size(zi,1) / size(zi,2)  ans =      0.1480  size(z,1) / size(z,2)  ans =      0.1481 

but need ensure aspect ratio of xi , yi in code above match original. pretty easy generalize well.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -