资源描述:
《用vb实现利用三次样条插值函数进行编程》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、用vb实现利用三次样条插值函数进行编程问题内容:要求输入节点数,节点值与端点二阶导数,能获得屏幕输出插值函数表达式网友cz5360于提问最佳回答:vb三次样条插值函数绘图DimX(1000)AsSingle,Y(1000)AsSingleDimu1(0To80000)AsSingle,v1(0To80000)AsSingleDimnumAsLongDimtAsIntegerPrivateDeclareSubSleepLib"kernel32"(ByValdwMillisecondsAsLong)DimdeAsInte
2、gerDimToInitAsBooleanDimDownXAsSingle,DownYAsSingleSubDrawposi(IndexAsInteger)Me.Picture1.ForeColor=0Me.Picture1.Line(0,Y(Index))-(1024,Y(Index))Me.Picture1.Line(X(Index),0)-(X(Index),770)EndSubFunctionhypot(ByValXAsSingle,ByValYAsSingle)hypot=Sqr(X^2+Y^2)EndFu
3、nctionSubMovePic(IndexAsInteger)DimiAsIntegerX(Index)=Picture2(Index).Left+4Y(Index)=Picture2(Index).Top+4lblX.Caption="X:"+CStr(CInt(X(Index)))lblY.Caption="Y:"+CStr(CInt(Y(Index)))lblX.RefreshlblY.RefreshMe.Picture1.ClsMe.Picture1.ForeColor=QBColor(10)Fori=0T
4、ot-1Me.Picture1.CurrentX=X(i)+4Me.Picture1.CurrentY=Y(i)+4Me.Picture1.PrintiNextiEndSubPrivateSubCommand1_Click()DimiAsLong'Picture1.Scale(0,0)-(640,550)DrawWidth=3Picture1.Cls'IfCheck1.ValueThenCommand2_Click'X(0)=1'Y(0)=1'X(t-1)=638'Y(t-1)=548Picture1.ForeCol
5、or=QBColor(10)Fori=0Tot-1Picture1.Line(X(i)-1,Y(i)-1)-(X(i)+1,Y(i)+1),QBColor(10),BPicture1.PrintiNextiPicture1.ForeColor=QBColor(12)DrawWidth=1tspLinet-1,2,0,0,0,0Picture1.PSet(u1(0),v1(0))Fori=1Tonum-1Picture1.Line-(u1(i),v1(i))'Forde=1To12000:Nextde'Sleep1Ne
6、xtiPicture1.ForeColor=QBColor(10)Fori=0Tot-1Picture1.Line(X(i)-1,Y(i)-1)-(X(i)+1,Y(i)+1),QBColor(10),BPicture1.PrintiNextiEndSubPrivateSubCommand2_Click()DimiAsIntegerRandomizeTimerToInit=NotToInitIfToInitThenMe.Command1.Enabled=FalseMe.Command2.Caption="结束初始化"
7、Me.ClsFori=1Tot-1LoadMe.Picture2(i)NextiFori=0Tot-1Picture2(i).Left=X(i)-4Picture2(i).Top=Y(i)-4Picture2(i).Visible=TrueNextiPicture1.ClsMe.Picture1.ForeColor=QBColor(10)Fori=0Tot-1Picture1.Line(X(i)-1,Y(i)-1)-(X(i)+1,Y(i)+1),QBColor(10),BPicture1.PrintiNextiEl
8、seMe.Command1.Enabled=TrueMe.Command2.Caption="开始初始化"Fori=1Tot-1UnloadMe.Picture2(i)NextiMe.Picture2(0).Visible=FalseEndIfExitSubFori=0TotX(i)=Rnd(1)*500+Rnd(1)*50+12Y(i)=Rn