MATLAB: Interpolating a whole matrix

interpolationlookup tablematrixsimulink

I have a (3×3)-matrix whose elements change with time. I store the time in a (n x 1)-array and the matrix in a (n x 3 x 3)-matrix. Now for a Simulink simulation I want to extract the (3 x 3)-matrix through interpolation by the simulation time.
Of course, in principle, I could just create interpolation tables for each element of the (3×3)-matrix and reassemble the outputs to a new (3×3)-matrix but I wonder if there'd be a simpler way.
N. B.: I don't have particular toolboxes.

Best Answer

  • % Making a sample data set
    % now interpolating to t=0.15
    A_interpolated=cellfun(@(x) interp1(time,x,0.15),B);