亲爱的网友们,对于matlab中griddata函数怎么用和matlab中的插值函数 griddat,很多人可能不是很了解。因此,今天我将和大家分享一些关于matlab中griddata函数怎么用和matlab中的插值函数 griddat的知识,希望能够帮助大家更好地理解这个话题。

本文目录一览

matlab中griddata函数怎么用

知道一系列点的坐标如下(1.486,3.059,0.1);(2.121,4.041,0.1);(2.570,3.959,0.1);(3.439,4.396,0.1);(4.505,3.012,0.1);(3.402,1.604,0.1);(2.570,2.065,0.1);(2.150,1.970,0.1);(1.794,3.059,0.2);(2.121,3.615,0.2);(2.570,3.473,0.2);(3.421,4.160,0.2);(4.271,3.036,0.2);(3.411,1.876,0.2);(2.561,2.562,0.2);(2.179,2.420,0.2);(2.757,3.024,0.3);(3.439,3.970,0.3);(4.084,3.036,0.3);(3.402,2.077,0.3);(2.879,3.036,0.4);(3.421,3.793,0.4);(3.953,3.036,0.4);(3.402,2.219,0.4);(3.000,3.047,0.5);(3.430,3.639,0.5);(3.822,3.012,0.5);(3.411,2.385,0.5);(3.103,3.012,0.6);(3.430,3.462,0.6);(3.710,3.036,0.6);(3.402,2.562,0.6);(3.224,3.047,0.7);(3.411,3.260,0.7);(3.542,3.024,0.7);(3.393,2.763,0.7)怎样用MATLAB绘制成三维曲面呢?

使用griddata插值

A=[1.486,3.059,0.1;2.121,4.041,0.1;2.570,3.959,0.1;3.439,4.396,0.1;
4.505,3.012,0.1;3.402,1.604,0.1;2.570,2.065,0.1;2.150,1.970,0.1;
1.794,3.059,0.2;2.121,3.615,0.2;2.570,3.473,0.2;3.421,4.160,0.2;
4.271,3.036,0.2;3.411,1.876,0.2;2.561,2.562,0.2;2.179,2.420,0.2;
2.757,3.024,0.3;3.439,3.970,0.3;4.084,3.036,0.3;3.402,2.077,0.3;
2.879,3.036,0.4;3.421,3.793,0.4;3.953,3.036,0.4;3.402,2.219,0.4;
3.000,3.047,0.5;3.430,3.639,0.5;3.822,3.012,0.5;3.411,2.385,0.5;
3.103,3.012,0.6;3.430,3.462,0.6;3.710,3.036,0.6;3.402,2.562,0.6;
3.224,3.047,0.7;3.411,3.260,0.7;3.542,3.024,0.7;3.393,2.763,0.7];
x=A(:,1);y=A(:,2);z=A(:,3);
scatter(x,y,5,z)%散点图
figure
[X,Y,Z]=griddata(x,y,z,linspace(1.486,4.271)',linspace(1.604,4.276),'v4');%插值
pcolor(X,Y,Z);shadinginterp%伪彩色图
figure,contourf(X,Y,Z)%等高线图
figure,surf(X,Y,Z)%三维曲面

返回目录

matlab中的插值函数 griddata的具体原理是什么呢?可否大概讲解一下!!!

griddata调用方法:
ZI=griddata(x,y,z,XI,YI)
[XI,YI,ZI]=griddata(x,y,z,XI,YI)
[...]=griddata(...,method)
[...]=griddata(...,method,options)

method的值为
'linear'--则,以三角形为基础的线性内插
'cubic'--则,以三角形为基础的三次方程内插
'nearest'--则,用最邻近的点内插
'v4'----则,MATLAB4格点样条函数内插
默认'linear'线性内插

三角形为基础,就是按Delaunay方法先找出内插点四周的3个点,构成三角形,内插点在三角形内。然后线性内插,或三次方程内插。

'cubic'和'v4'插值结果构成的曲面较光滑,'linear'和'nearest'插值结果构成的曲面不光滑不连续。

前3种方法具体算法见
[1]Barber,C.B.,D.P.Dobkin,andH.T.Huhdanpaa,"TheQuickhullAlgorithmforConvexHulls,"ACMTransactionsonMathematicalSoftware,Vol.22,No.4,Dec.1996,p.469-483.AvailableinPDFformatathttp://www.acm.org/pubs/citations/journals/toms/1996-22-4/p469-barber/.

第4种方法具体算法见
[2]Sandwell,DavidT.,"BiharmonicSplineInterpolationofGEOS-3andSEASATAltimeterData",GeophysicalResearchLetters,14,2,139-142,1987.

(参考了MathWorks主站材料)

返回目录

总结:以上就是本站针对你的问题搜集整理的答案,希望对你有所帮助。