MATLAB Mathematics - SERC - Index of
MATLAB Mathematics - SERC - Index of MATLAB Mathematics - SERC - Index of
2 Polynomials and Interpolation 2 Generate a finer mesh for interpolation: [xi,yi] = meshgrid(-3:0.25:3); 3 Interpolate using nearest neighbor interpolation: zi1 = interp2(x,y,z,xi,yi,'nearest'); 4 Interpolate using bilinear interpolation: zi2 = interp2(x,y,z,xi,yi,'bilinear'); 5 Interpolate using bicubic interpolation: zi3 = interp2(x,y,z,xi,yi,'bicubic'); 6 Compare the surface plots for the different interpolation methods. 6 6 6 4 4 4 2 2 2 0 0 0 −2 −2 −2 −4 −4 −4 −6 3 2 1 0 −1 −2 −3 −3 −2 −1 0 1 2 3 −6 3 2 1 0 −1 −2 −3 −3 −2 −1 0 1 2 3 −6 3 2 1 0 −1 −2 −3 −3 −2 −1 0 1 2 3 surf(xi,yi,zi1) % nearest surf(xi,yi,zi2) % bilinear surf(xi,yi,zi3) % bicubic 2-14
Interpolation 7 Compare the contour plots for the different interpolation methods. 3 3 3 2 2 2 1 1 1 0 0 0 −1 −1 −1 −2 −2 −2 −3 −3 −2 −1 0 1 2 3 −3 −3 −2 −1 0 1 2 3 −3 −3 −2 −1 0 1 2 3 contour(xi,yi,zi1) % nearest contour(xi,yi,zi2) % bilinear contour(xi,yi,zi3) % bicubic Notice that the bicubic method, in particular, produces smoother contours. This is not always the primary concern, however. For some applications, such as medical image processing, a method like nearest neighbor may be preferred because it doesn’t generate any “new” data values. Interpolation and Multidimensional Arrays Several interpolation functions operate specifically on multidimensional data. Interpolation Functions for Multidimensional Data Function interp3 interpn ndgrid Description Three-dimensional data interpolation. Multidimensional data interpolation. Multidimensional data gridding (elmat directory). This section discusses • Interpolation of three-dimensional data • Interpolation of higher dimensional data • Multidimensional data gridding 2-15
- Page 18 and 19: 1 Matrices and Linear Algebra If x
- Page 20 and 21: 1 Matrices and Linear Algebra y = v
- Page 22 and 23: 1 Matrices and Linear Algebra Vecto
- Page 24 and 25: 1 Matrices and Linear Algebra backs
- Page 26 and 27: 1 Matrices and Linear Algebra If A
- Page 28 and 29: 1 Matrices and Linear Algebra You c
- Page 30 and 31: 1 Matrices and Linear Algebra 0.9 0
- Page 32 and 33: 1 Matrices and Linear Algebra Inver
- Page 34 and 35: 1 Matrices and Linear Algebra X = p
- Page 36 and 37: 1 Matrices and Linear Algebra There
- Page 38 and 39: 1 Matrices and Linear Algebra The e
- Page 40 and 41: 1 Matrices and Linear Algebra The L
- Page 42 and 43: 1 Matrices and Linear Algebra In co
- Page 44 and 45: 1 Matrices and Linear Algebra Matri
- Page 46 and 47: 1 Matrices and Linear Algebra compu
- Page 48 and 49: 1 Matrices and Linear Algebra Eigen
- Page 50 and 51: 1 Matrices and Linear Algebra produ
- Page 52 and 53: 1 Matrices and Linear Algebra Singu
- Page 54 and 55: 1 Matrices and Linear Algebra 1-44
- Page 56 and 57: 2 Polynomials and Interpolation Pol
- Page 58 and 59: 2 Polynomials and Interpolation pol
- Page 60 and 61: 2 Polynomials and Interpolation Cal
- Page 62 and 63: 2 Polynomials and Interpolation whe
- Page 64 and 65: 2 Polynomials and Interpolation Int
- Page 66 and 67: 2 Polynomials and Interpolation int
- Page 70 and 71: 2 Polynomials and Interpolation Int
- Page 72 and 73: 2 Polynomials and Interpolation for
- Page 74 and 75: 2 Polynomials and Interpolation Con
- Page 76 and 77: 2 Polynomials and Interpolation Lat
- Page 78 and 79: 2 Polynomials and Interpolation −
- Page 80 and 81: 2 Polynomials and Interpolation −
- Page 82 and 83: 2 Polynomials and Interpolation 7 3
- Page 84 and 85: 2 Polynomials and Interpolation T =
- Page 86 and 87: 2 Polynomials and Interpolation Bec
- Page 88 and 89: 2 Polynomials and Interpolation Int
- Page 90 and 91: 2 Polynomials and Interpolation 2-3
- Page 92 and 93: 2 Polynomials and Interpolation 2-3
- Page 94 and 95: 3 Fast Fourier Transform (FFT) Intr
- Page 96 and 97: 3 Fast Fourier Transform (FFT) 200
- Page 98 and 99: 3 Fast Fourier Transform (FFT) 2 x
- Page 100 and 101: 3 Fast Fourier Transform (FFT) 500
- Page 102 and 103: 3 Fast Fourier Transform (FFT) Func
- Page 104 and 105: 4 Function Functions Function Summa
- Page 106 and 107: 4 Function Functions You can also c
- Page 108 and 109: 4 Function Functions 25 20 15 10 5
- Page 110 and 111: 4 Function Functions Minimizing Fun
- Page 112 and 113: 4 Function Functions To try fminsea
- Page 114 and 115: 4 Function Functions Plotting the R
- Page 116 and 117: 4 Function Functions The number of
2 Polynomials and Interpolation<br />
2 Generate a finer mesh for interpolation:<br />
[xi,yi] = meshgrid(-3:0.25:3);<br />
3 Interpolate using nearest neighbor interpolation:<br />
zi1 = interp2(x,y,z,xi,yi,'nearest');<br />
4 Interpolate using bilinear interpolation:<br />
zi2 = interp2(x,y,z,xi,yi,'bilinear');<br />
5 Interpolate using bicubic interpolation:<br />
zi3 = interp2(x,y,z,xi,yi,'bicubic');<br />
6 Compare the surface plots for the different interpolation methods.<br />
6<br />
6<br />
6<br />
4<br />
4<br />
4<br />
2<br />
2<br />
2<br />
0<br />
0<br />
0<br />
−2<br />
−2<br />
−2<br />
−4<br />
−4<br />
−4<br />
−6<br />
3<br />
2<br />
1<br />
0<br />
−1<br />
−2<br />
−3<br />
−3<br />
−2<br />
−1<br />
0<br />
1<br />
2<br />
3<br />
−6<br />
3<br />
2<br />
1<br />
0<br />
−1<br />
−2<br />
−3<br />
−3<br />
−2<br />
−1<br />
0<br />
1<br />
2<br />
3<br />
−6<br />
3<br />
2<br />
1<br />
0<br />
−1<br />
−2<br />
−3<br />
−3<br />
−2<br />
−1<br />
0<br />
1<br />
2<br />
3<br />
surf(xi,yi,zi1)<br />
% nearest<br />
surf(xi,yi,zi2)<br />
% bilinear<br />
surf(xi,yi,zi3)<br />
% bicubic<br />
2-14