- 1、本文档共8页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
编程作业第1题
#ifndef CONST_H
#define CONST_H
#define USENUM 6
#define PX 110
#define PY 110
#endif
#include stdio.h
#include stdlib.h
#include base.h
#include matrix.h
int main() {
Point* points[10];
int i=0;
double *M=NULL, *P=NULL, *Z=NULL, *X=NULL;
double *MT=NULL, *RES=NULL;
for(; i10; i++) {
points[i] = (Point*)malloc(sizeof(Point));
}
points[0]-x=102; points[0]-y=110; points[0]-z=15;
points[1]-x=109; points[1]-y=113; points[1]-z=18;
points[2]-x=105; points[2]-y=115; points[2]-z=19;
points[3]-x=103; points[3]-y=103; points[3]-z=17;
points[4]-x=108; points[4]-y=105; points[4]-z=21;
points[5]-x=105; points[5]-y=108; points[5]-z=15;
points[6]-x=115; points[6]-y=104; points[6]-z=20;
points[7]-x=118; points[7]-y=108; points[7]-z=15;
points[8]-x=116; points[8]-y=113; points[8]-z=17;
points[9]-x=113; points[9]-y=118; points[9]-z=22;
init(points, 10);
selectP(points, 10, 6);
M = getM(points, 6);
P = getP(points, 6);
Z = getZ(points, 6);
MT = MatrixInver(M, 6, 6);
RES = MatrixMultiple(MT, 6, 6, P, 6, 6);
RES = MatrixMultiple(RES, 6, 6, M, 6, 6);
RES = MatrixOpp(RES, 6, 6);
RES = MatrixMultiple(RES, 6, 6, MT, 6, 6);
RES = MatrixMultiple(RES, 6, 6, P, 6, 6);
RES = MatrixMultiple(RES, 6, 6, Z, 6, 1);
printf(Result is %f\n, RES[5]);
return 0;
}
#include stdio.h
#include stdlib.h
#include base.h
int init (Point *(*sample), const int size) {
int i=0;
const Point targetP = {PX, PY, 0, 0};
while (i size) {
sample[i]-dis = getDis(sample[i], targetP);
i++;
}
i = 0;
while (i size) {
sample[i]-x = sample[i]-x - PX;
sample[i]-y = sample[i]-y - PY;
i++;
}
return 0;
}
int selectP (Point *(*sample), const int size, const int useNum) {
int i=0, j=0;
Point *temp;
for(; isize-1; i++) {
for(j=i+1; jsize; j++) {
if(sample[i]-dis sample[j]-dis) {
temp = sample[i];
sample[i] = sample[j];
sample[j] = temp;
}
}
}
return 0;
}
double* getM (const Point *(*p), const int useNum) {
double *M = NULL;
int i=0;
M = (do
您可能关注的文档
- 绘画类课程的设计的方案.doc
- 结题验收证书模板.doc
- 给家乡孩子信教案.doc
- 给2013考生设计应试方法.doc
- 统计从业考试2011年度.docx
- 统考常见问题问和答.doc
- 统计原理第8章习题.doc
- 统计学6章客观题解析.doc
- 结题汇报[文章节].doc
- 给排水相关定额解析.doc
- 25上半年2期套题班-行政职业能力测验(八).docx
- 公考讲义-2025年1月时政汇总.pdf
- 2025年省考逻辑填空1000 高频实词积累+刷题早读课 讲义.pdf
- 25上半年2期套题班-行政职业能力测验(九).docx
- 2025四川事业编FB综合岗考试-综合能力测试讲义-主观题基础,案例分析题,公文写作及文章写作题.pdf
- 25上半年2期套题班-行政职业能力测验(五).docx
- 2025申论多省联考刷题课真题资料-2025国考执法课程.doc
- 2025申论多省联考刷题课真题资料-2024江西执法课程.doc
- 25上半年2期套题班-行政职业能力测验(十).docx
- 2025申论多省联考刷题课真题资料-2024福建县乡课程.doc
最近下载
- 把规矩和纪律挺在前面心得体会模板.docx VIP
- 2025年中国新疆农产品贸易市场全面调研及行业投资潜力预测报告.docx
- 新人教版八年级物理下册知识点总结.doc VIP
- 海南版信息技术四年级下册第1课 制作文本幻灯片.pptx VIP
- 7.1.3++亚洲的自然环境+课件+-2024-2025学年人教版地理七年级下册.pptx VIP
- 部编人教版九年级语文下册作业课件 专题 专题五 古诗文默写.ppt
- 马工程教材《公共财政概论》PPT-第二章 公共财政职能.ppt
- 广西财政预算管理一体化系统操作手册-财政版东兴市.pdf VIP
- 上市公司财务报表分析——以新希望六和股份有限公司为例.docx
- 【良品铺子公司基于EVA模型指标的财务绩效评价研究】15000字.docx
文档评论(0)