核数据处理课程设计.docx

上传人:b****2 文档编号:2701983 上传时间:2023-05-04 格式:DOCX 页数:34 大小:1,017.33KB
下载 相关 举报
核数据处理课程设计.docx_第1页
第1页 / 共34页
核数据处理课程设计.docx_第2页
第2页 / 共34页
核数据处理课程设计.docx_第3页
第3页 / 共34页
核数据处理课程设计.docx_第4页
第4页 / 共34页
核数据处理课程设计.docx_第5页
第5页 / 共34页
核数据处理课程设计.docx_第6页
第6页 / 共34页
核数据处理课程设计.docx_第7页
第7页 / 共34页
核数据处理课程设计.docx_第8页
第8页 / 共34页
核数据处理课程设计.docx_第9页
第9页 / 共34页
核数据处理课程设计.docx_第10页
第10页 / 共34页
核数据处理课程设计.docx_第11页
第11页 / 共34页
核数据处理课程设计.docx_第12页
第12页 / 共34页
核数据处理课程设计.docx_第13页
第13页 / 共34页
核数据处理课程设计.docx_第14页
第14页 / 共34页
核数据处理课程设计.docx_第15页
第15页 / 共34页
核数据处理课程设计.docx_第16页
第16页 / 共34页
核数据处理课程设计.docx_第17页
第17页 / 共34页
核数据处理课程设计.docx_第18页
第18页 / 共34页
核数据处理课程设计.docx_第19页
第19页 / 共34页
核数据处理课程设计.docx_第20页
第20页 / 共34页
亲,该文档总共34页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

核数据处理课程设计.docx

《核数据处理课程设计.docx》由会员分享,可在线阅读,更多相关《核数据处理课程设计.docx(34页珍藏版)》请在冰点文库上搜索。

核数据处理课程设计.docx

核数据处理课程设计

核工程与新能源技术系

课程设计报告

 

题目课程设计报告

系别核工程与新能源技术系

年级2012级专业核工程与核技术

班级核技术3班学号201220401XXX

学生姓名岳XX

指导教师张艳丽职称讲师

所属课程核数据处理实验

设计时间2014-11-16

 

课程设计独创性声明:

本课程设计是在老师指导下个人独立完成的。

学生签名:

课程设计评分标准(按教学大纲评定)

课程设计报告成绩:

平时成绩:

总成绩:

指导教师签名:

教研室主任签名:

实验中心主任签名:

 

目录

一、设计任务及目的页码

二、任务梗概页码

三、任务实现页码

1、设计内容一(计算器制作)页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码

2、设计内容二(制作“输入数据”“显示图像”“五点平滑”页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码

3、设计内容五(制作“左边界”“右边界”“寻峰”按钮)页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码

4、设计内容六(制作左边界、右边界、寻峰、道址能量公式、能量刻度显示编辑框)页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码5、设计内容七(制作求总面积、本地面积、净面积与其编辑框)页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码6、设计内容八(菜单栏、工具栏、状态栏)页码

(1)任务要求页码

(2)任务步骤页码

(3)任务效果页码

四、设计总结(感受)页码

 

一、设计任务及目的一、实验目的:

1、通过实验学会自主思考设计软件程序; 

2、通过实验懂得如何运用一些软件完成程序设并实现预期功能; 3、在软件设计过程中逐步掌握能谱分析的基本过程; 

4、通过设计知道怎样才能完成能谱的准确分析得出正确分析结果; 

5、通过实验了解我们所运用能谱分析仪的工作过程,特别是其后部分能谱处理原理。

6、掌握图形程序的编写技巧。

二、实验要求:

1、自觉完成实验设计,不抄袭; 

2、查阅资料,讨论、了解该设计性实验的实现基本过程; 3、能够团结同学,采纳同学的意见与分析方法、进行合理取舍; 

4、运用软件程序完成能谱分析,并实现能谱的准确分析,做到能谱的数据获取、平滑、寻峰、刻度等 

5、按时完成实验任务、上交实验成果。

三、实验任务:

1、通过实践培养学生实际动手能力,熟悉核数据处理的过程和方法,打下坚实的核物理实验及核数据处理基础,巩固C语言的学习。

二、任务梗概

1、C语言基础复习。

2、制作计算器。

3、读谱数据文件、保存光滑后的谱数据文件,文件名可选。

4、显示谱数据,各算法要以及函数方式实现、左右边界选取。

5、显示分析谱段范围内,寻得的各峰位道址、能量。

6、能量刻度。

7、显示寻峰级峰面积计算结果。

三、任务实现以

一、计算器制作

1、要求:

最低要求:

能完成双精度型数值的加、减、乘、除计算;编程中使用了动态连接库技术.

较高要求:

能完成双精度型数值的加、减、乘、除计算;编程中使用了动态连接库技术; 能实现表达式的输入,解析与计算。

2、步骤:

1、先建立一个工程,截图如下

2,然后制作计算器的界面

3,建立类向导写程序如下。

voidCJmxjisuanqiDlg:

:

Onjia()

{

UpdateData(true);

m_Result=m_Firtn+m_Secn;

UpdateData(false);

}

voidCJmxjisuanqiDlg:

:

Onjian()

{

UpdateData(true);

m_Result=m_Firtn-m_Secn;

UpdateData(false);

}

voidCJmxjisuanqiDlg:

:

Oncheng()

{

UpdateData(true);

m_Result=m_Firtn-m_Secn;

UpdateData(false);

}

voidCJmxjisuanqiDlg:

:

Onchu()

{

UpdateData(true);

m_Result=m_Firtn/m_Secn;

UpdateData(false);

}

4,运行得到的的界面和结果

 

二、“输入数据”等按钮

通过对C语言文件相关函数的掌握并熟悉运用可以写出以下实验。

1、创立一个工程文件。

截屏如下:

2、对于按钮键编写属性和建立类向导,建立类向导的程序如下。

voidCJMXDlg:

:

Onduqushuju()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

FILE*fp;

intdatanum=0,data[2048];

floatdata_ph[2048];

inti;

intdata1,data2;

if((fp=fopen("090623.txt","r"))==NULL)

{

printf("Cannotopenthefile.\n");

exit(0);

}

while(!

feof(fp))

{

fscanf(fp,"%d%d",&data1,&data2);

data[datanum++]=data2;

fscanf(fp,"\n");

}

for(i=0;i<2048;i++)

{

if(i<2||i>2045)

data_ph[i]=data[i];

else

data_ph[i]=(data[i-2]+4*data[i-1]+6*data[i]+4*data[i+1]+data[i+2])*1.0/16.0;

printf("%f\n",data_ph[i]);

}

fclose(fp);

if((fp=fopen("OUT1.txt","w"))==NULL)

{

printf("fileopenerror.\n");

exit(0);

}

for(i=0;i<2048;i++)

{

fprintf(fp,"%d%f\n",i+1,data_ph[i]);

}

fclose(fp);

注意:

在编程时要把所给的数据文本文件要在所创立的文件下去编写程序。

所给的数据文本文件090623.txt。

 

编译连接。

点击读取数据按钮,然后打开生成的OUT1.txt文本文件

三、“显示图像”按钮

建立工程

通过对按钮类向导建立类向导编程

1,对读取数据建立类向导。

voidCxianshitupuDlg:

:

Onduqushuju()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

FILE*fp;

intdatanum=0;

inti;

intdata1,data2;

if((fp=fopen("090623.txt","r"))==NULL)

{printf("Cannotopenthefile.\n");

exit(0);

}

while(!

feof(fp))

{

fscanf(fp,"%d%d",&data1,&data2);

data[datanum++]=data2;

fscanf(fp,"\n");

}

for(i=0;i<2048;i++)

{if(i<2||i>2045)

data_ph[i]=data[i];

else

data_ph[i]=(data[i-2]+4*data[i-1]+6*data[i]+4*data[i+1]+data[i+2])*1.0/16.0;

printf("%d%f\n",i+1,data_ph[i]);

}

fclose(fp);

if((fp=fopen("out.txt","w"))==NULL)

{printf("fileopenerror.\n");

exit(0);

}

for(i=0;i<2048;i++)

{fprintf(fp,"%d%f\n",i+1,data_ph[i]);

}

fclose(fp);

}

2.对显示原图普按钮建立内向导

voidCXianshitupuDlg:

:

OnYuantupu()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

doublexViewport,yViewport;

intmax;

CWnd*pWnd=GetDlgItem(IDC_P1);

CDC*pDC=pWnd->GetDC();

pDC->SetMapMode(MM_ANISOTROPIC);

CRectrect;

doublescale;

GetDlgItem(IDC_P1)->GetWindowRect(&rect);

scale=25.4*10/pDC->GetDeviceCaps(LOGPIXELSX);

CDCMemDC;

CBitmapMemBitmap;

MemDC.CreateCompatibleDC(NULL);

MemBitmap.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());

MemDC.FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(255,255,255));

max=data[0];

for(inti=1;i<2048;i++)

{if(data[i]>max)

max=data[i];

}

for(i=0;i<2048;i++)

{

xViewport=(i+1)*rect.Width()/2048;

yViewport=(0.67*data[i]*rect.Height())/max+10;

pDC->SetPixel(xViewport,rect.Height()-yViewport-1,RGB(255,0,0));

pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);

}

MemBitmap.DeleteObject();

MemDC.DeleteDC();

pDC->DeleteDC();

}

3.对显示五点平滑图谱建立内向导

voidCXianshitupuDlg:

:

OnXianshiwudian()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

doublexViewport,yViewport;

floatmax;

CWnd*pWnd=GetDlgItem(IDC_P2);

CDC*pDC=pWnd->GetDC();

pDC->SetMapMode(MM_ANISOTROPIC);

CRectrect;

doublescale;

GetDlgItem(IDC_P2)->GetWindowRect(&rect);

scale=25.4*10/pDC->GetDeviceCaps(LOGPIXELSX);

CDCMemDC;

CBitmapMemBitmap;

MemDC.CreateCompatibleDC(NULL);

MemBitmap.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());

MemDC.FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(255,255,255));

max=data_ph[0];

for(inti=1;i<2048;i++)

{if(data_ph[i]>max)

max=data_ph[i];

}

for(i=0;i<2048;i++)

{

xViewport=(i+1)*rect.Width()/2048;

yViewport=(0.67*data_ph[i]*rect.Height())/max+10;

pDC->SetPixel(xViewport,rect.Height()-yViewport-1,RGB(255,0,0));

}

pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);

MemBitmap.DeleteObject();

MemDC.DeleteDC();

pDC->DeleteDC();

效果图

 

寻峰及道指换算

建立工程

1.对左边界建立内向导

voidCxunfengjidaozhihuansuanDlg:

:

Onzuobianjie()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

LButton_Clicked=1;

left_flag=1;

Left_x=x_old;

Left_y=y_old;

}

2.右边界五点寻峰建立内向导

voidCxunfengjidaozhihuansuanDlg:

:

Onyoubianjiewudianxunfeng()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

inti,j,xl,xr,max=0,maxi=0;

floatnewx;

CRectrect1;

CWnd*pWnd=GetDlgItem(IDC_P1);

pWnd->GetWindowRect(rect1);

ScreenToClient(&rect1);

CDC*pDC=pWnd->GetDC();

RButton_Clicked=1;

if(left_flag==1)

{Right_x=x_old;

Right_y=y_old;

//GetDlgItem(IDC_P1)->GetWindowRect(&rect1);

xl=2048*(Left_x-rect1.left)/rect1.Width();

xr=2048*(Right_x-rect1.left)/rect1.Width();

for(i=xl+2;i

{

if((data[i]-1.0*sqrt(data[i])>data[i-2])&&(data[i]-1.0*sqrt(data[i])>data[i+2]))

{

for(j=i-2;j

{

if(data[j]>max)

{

max=data[j];

maxi=j;

}

m_e3=maxi;

UpdateData(false);

}

}

}

newx=maxi*rect1.Width()/2048;

CDC*pDC=pWnd->GetDC();

CPenlpen(PS_SOLID,1,RGB(0,0,255));

CPen*pOldPen=pDC->SelectObject(&lpen);

//scale=25.4*10/pDC->GetDeviceCaps(LOGPIXELSX);

pDC->MoveTo(newx,0);

pDC->LineTo(newx,rect1.Height());

lpen.DeleteObject();

}

RButton_Clicked=0;

LButton_Clicked=0;

}

3.左道址建立内向导

voidCxuanfengjidaozhihuansuanDlg:

:

OnZuodaozhi()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

CRectrect1;

intchx;

CWnd*pWnd=GetDlgItem(IDC_P1);

pWnd->GetWindowRect(rect1);

ScreenToClient(&rect1);

chx=2048*(x_old-rect1.left)/rect1.Width();

m_e1=chx;

UpdateData(false);

}

4.右道指建立内向导

voidCxunfengjidaozhihuansuanDlg:

:

OnYoudaozhi()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

CRectrect1;

intchx;

CWnd*pWnd=GetDlgItem(IDC_P1);

pWnd->GetWindowRect(rect1);

ScreenToClient(&rect1);

chx=2048*(x_old-rect1.right)/rect1.Width();

m_e2=chx;

UpdateData(false);

}

显示图谱的结果

五。

求峰面积

建立工作空间

1.读取数据,建立内向导

voidCqiufengmianjiDlg:

:

OnDuqushuju()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

FILE*fp;

intdatanum=0;

inti;

intdata1,data2;

if((fp=fopen("090623.txt","r"))==NULL)

{printf("Cannotopenthefile.\n");

exit(0);

}

while(!

feof(fp))

{

fscanf(fp,"%d%d",&data1,&data2);

data[datanum++]=data2;

fscanf(fp,"\n");

}

for(i=0;i<2048;i++)

{if(i<2||i>2045)

data_ph[i]=data[i];

else

data_ph[i]=(data[i-2]+4*data[i-1]+6*data[i]+4*data[i+1]+data[i+2])*1.0/16.0;

printf("%d%f\n",i+1,data_ph[i]);

}

fclose(fp);

if((fp=fopen("out.txt","w"))==NULL)

{printf("fileopenerror.\n");

exit(0);

}

for(i=0;i<2048;i++)

{fprintf(fp,"%d%f\n",i+1,data_ph[i]);

}

fclose(fp);

}

2.原始图谱,建立内向导

voidCqufengmiangjiDlg:

:

OnYuanshitupu()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

doublexViewport,yViewport;

intmax;

CWnd*pWnd=GetDlgItem(IDC_P1);

CDC*pDC=pWnd->GetDC();

pDC->SetMapMode(MM_ANISOTROPIC);

CRectrect;

doublescale;

GetDlgItem(IDC_P1)->GetWindowRect(&rect);

scale=25.4*10/pDC->GetDeviceCaps(LOGPIXELSX);

CDCMemDC;

CBitmapMemBitmap;

MemDC.CreateCompatibleDC(NULL);

MemBitmap.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());

MemDC.FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(255,255,255));

max=data[0];

for(inti=1;i<2048;i++)

{

if(data[i]>max)

max=data[i];

}

for(i=0;i<2048;i++)

{

xViewport=(i+1)*rect.Width()/2048;

yViewport=(0.67*data[i]*rect.Height())/max+10;

pDC->SetPixel(xViewport,rect.Height()-yViewport-1,RGB(255,0,0));

pDC->BitBlt(0,0,rect.Width(),rect.Height(),&MemDC,0,0,SRCCOPY);

}

MemBitmap.DeleteObject();

MemDC.DeleteDC();

pDC->DeleteDC;

}

3.显示五点平滑图谱。

建立内向导

voidCqiufengmianjiDlg:

:

Onxianshiwudianpinghuatupu()

{

//TODO:

Addyourcontrolnotificationhandlercodehere

doublexViewport,yViewport;

floatmax;

CWnd*pWnd=GetDlgItem(IDC_P2);

CDC*pDC=pWnd->GetDC();

pDC->SetMapMode(MM_ANISOTROPIC);

CRectrect;

doublescale;

GetDlgItem(IDC_P2)->GetWindowRect(&rect);

scale=25.4*10/pDC->GetDeviceCaps(LOGPIXELSX);

CDCMemDC;

CBitmapMemBitmap;

MemDC.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 动态背景

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2