Tutorial by Examples

We initialize the data: [X,Y] = meshgrid(1:2:10); Z = X.*cos(Y) - Y.*sin(X); The surface looks like the following. Now we set the points where we want to interpolate: [Vx,Vy] = meshgrid(1:0.25:10); We now can perform nearest interpolation, Vz = interp2(X,Y,Z,Vx,Vy,'nearest'); line...
We will use the following data: x = 1:5:50; y = randi([-10 10],1,10); Hereby x and y are the coordinates of the data points and z are the points we need information about. z = 0:0.25:50; One way to find the y-values of z is piecewise linear interpolation. z_y = interp1(x,y,z,'linear'); ...
We initialize the data we want to interpolate: x = 0:0.5:10; y = sin(x/2); This means the underlying function for the data in the interval [0,10] is sinusoidal. Now the coefficients of the approximating polynómials are being calculated: p1 = polyfit(x,y,1); p2 = polyfit(x,y,2); p3 = polyfit(...

Page 1 of 1