资源描述:
《数值分析课程的实验报告》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验报告实验课程:学生姓名:学号:专业班级:2012年6月8日23目录---(1)用C语言或C++编程显示字母T与53---(2)原子弹爆炸能量估计11---(3)城市水管埋多深15---(4)实现PageRank算法1823·计算机系数值分析实验报告---(1)用C语言或C++编程显示字母T与5学生姓名:学号:专业班级:实验类型:■验证□综合□设计□创新实验日期:2012/4/20实验成绩:一、实验目的用C语言或C++编程显示字母T与5。二、实验基本原理和内容Bezier曲线生成:1、确定曲线的
2、阶次;2、计算Bernstein基函数的表达式:B0,3(t)﹦(1-t)3;B1,3(t)﹦3t(1-t)2;B2,3(t)﹦3t2(1-t);B3,3(t)﹦t33、把Bezier曲线中的Pk写成分量坐标的形式4、确定一合适的步长;控制t从0到1变化,求出一系列(x,y)坐标点;将其用小线段顺序连接起来。三、算法分析对于二维平面的情况,只有x,y坐标分量,可以给出四点三次Bezier曲线如下的算法描述:输入:阶次,3;控制顶点:4个,(x0,y0),…,(x3,y3)beginx=x0y=y0
3、moveto(x,y)fort﹦0to1stepDtx﹦B0,3(t)x0﹢B1,3(t)x1﹢B2,3(t)x2﹢B3,3(t)x3y﹦B0,3(t)y0﹢B1,3(t)y1﹢B2,3(t)y2﹢B3,3(t)y3lineto(x,y)endforend三次Bezier曲线例子:设在平面上给定的7个控制点坐标分别为:A(100,300),B(120,200),C(220,200),D(270,100),E(370,100),F(420,200),G(420,300)。画出其曲线。23四、实验内容
4、和过程代码://xx.cpp:Definestheentrypointfortheapplication.//#include"stdafx.h"#include"resource.h"#defineMAX_LOADSTRING100//GlobalVariables:HINSTANCEhInst;//currentinstanceTCHARszTitle[MAX_LOADSTRING];//ThetitlebartextTCHARszWindowClass[MAX_LOADSTRING];//T
5、hetitlebartext//Fowarddeclarationsoffunctionsincludedinthiscodemodule:ATOMMyRegisterClass(HINSTANCEhInstance);BOOLInitInstance(HINSTANCE,int);LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);LRESULTCALLBACKAbout(HWND,UINT,WPARAM,LPARAM);//=============
6、======================================//===========要我们加的数据================int23xT[15][4]={237,237,237,237,237,237,226,143,143,143,143,143,143,143,435,435,435,435,435,435,435,353,339,339,339,339,339,339,339,507,529,552,552,552,576,576,576,576,570,570,5
7、70,570,6,6,6,6,0,0,0,0,24,24,24,48,71,183,183,183,237,237};intyT[15][4]={620,620,120,120,120,35,24,19,19,19,0,0,0,0,0,0,0,0,19,19,19,23,36,109,109,108,620,620,620,620,602,492,492,492,492,492,492,492,662,662,662,662,662,662,662,662,492,492,492,492,492,
8、492,492,602,620,620,620,620,620,620};intx5[21][4]={149,149,149,345,345,361,356,368,368,406,368,406,406,397,406,397,397,382,372,351,351,351,351,142,142,33,142,33,33,32,32,32,32,32,35,44,44,74,109,149,149,269,324,324,324,324,264,185,185,165,149,