Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab interpolation for 3 axis data

  1. Nov 26, 2009 #1
    I'm doing a project in medicine, I've used matlab to create 3d graphs using a vector with 5 fixed values as X, a vector with 7 fixed values as Y. As Z I have 5*7 measured values.

    I need to interpolate my graph to "smoothen" the lines in the graph, but I am totaly lost, I have no idea how to do this. Could someone show me a practical example of needed matlab code for this I would be very thankful.
  2. jcsd
  3. Nov 27, 2009 #2
    This might get you started, it interpolates and smooths the data by 4X. It only works on a square matrices at the moment.

    clear all; close all;
    mat = rand(7);
    [X,Y] = meshgrid(1:7,1:7);
    [XI,YI] = meshgrid(1:.25:7); %This increases sampling by 4X)
    shading interp
    Zsmooth = interp2(X,Y,mat,XI,YI, 'spline');
    figure2 = figure;
    figure2 = surf(XI,YI,Zsmooth);
    shading interp
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Matlab interpolation for 3 axis data
  1. Matlab- interpolation (Replies: 0)