Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sparse Matrix Interpolation With MATLAB

Tags:

People also ask

How do you do interpolation in MATLAB?

vq = interp1( x , v , xq ) returns interpolated values of a 1-D function at specific query points using linear interpolation. Vector x contains the sample points, and v contains the corresponding values, v(x). Vector xq contains the coordinates of the query points.

How do you make a sparse matrix in MATLAB?

S = sparse( m,n ) generates an m -by- n all zero sparse matrix. S = sparse( i,j , v ) generates a sparse matrix S from the triplets i , j , and v such that S(i(k),j(k)) = v(k) . The max(i) -by- max(j) output matrix has space allotted for length(v) nonzero elements.

What does Griddata do in MATLAB?

The griddata function interpolates the surface at the query points specified by (xq,yq) and returns the interpolated values, vq . The surface always passes through the data points defined by x and y . vq = griddata( x , y , z , v , xq , yq , zq ) fits a hypersurface of the form v = f(x,y,z).


If I have a matrix like this

A = [1 2; 3 4];

I can use interp2 to interpolate it like this

newA = interp2(A,2);

and I get a 5x5 interpolated matrix.

But what if I have a matrix like this:

B = zeros(20);
B(3,2) = 5;
B(17,4) = 3;
B(16, 19) = 2.3;
B(5, 18) = 4.5;

How would I interpolate (or fill-in the blanks) this matrix. I've looked into interp2 as well as TriScatteredInterp but neither of these seem to fit my needs exactly.