IgorPro实用教程代码第1章Word格式.docx

上传人:b****6 文档编号:16692597 上传时间:2022-11-25 格式:DOCX 页数:124 大小:65.38KB
下载 相关 举报
IgorPro实用教程代码第1章Word格式.docx_第1页
第1页 / 共124页
IgorPro实用教程代码第1章Word格式.docx_第2页
第2页 / 共124页
IgorPro实用教程代码第1章Word格式.docx_第3页
第3页 / 共124页
IgorPro实用教程代码第1章Word格式.docx_第4页
第4页 / 共124页
IgorPro实用教程代码第1章Word格式.docx_第5页
第5页 / 共124页
点击查看更多>>
下载资源
资源描述

IgorPro实用教程代码第1章Word格式.docx

《IgorPro实用教程代码第1章Word格式.docx》由会员分享,可在线阅读,更多相关《IgorPro实用教程代码第1章Word格式.docx(124页珍藏版)》请在冰豆网上搜索。

IgorPro实用教程代码第1章Word格式.docx

Make/O/N=200root:

tmp:

cmpwave;

setscale/Px,0,2*pi/199,”s”,sinx

setscale/Ix,0,2*pi,”s”,sinx

Duplicate/Ooldwave,newwave;

dupplicate/O/R=(x1,x2)oldwave,newwave;

dupplicate/O/R=[p1,p2]oldwave,newwave;

Make/Odata={1,2,3}

Make/Odata

Setscale/Px,0,0.001,data

Variabletau=0.01

Data=exp(-x/0.01)

Make/Odata1

Data1=data[p]

1.2.5

Variablev1;

//申明一个普通变量

Variable/Cv1;

//申明一个复数变量

Variable/Gv1;

//申明一个全局变量

Stringstr;

//申明一个字符串变量

1.2.6

Functionfunc()

Stringcurr=getdatafolder

(1)//获取当前目录

Setdataflodermydestfd//mydestfd应该存在,存放了要处理的数据

//somethingtobedone

Setdatafoldercurr//恢复当前目录

End

1.2.11

Integrate1D(UserFunctionName,min_x,max_x[,options[,count]])

Integrate[/DIM=d/METH=m/P/T][typeFlags]yWaveA[/X=xWaveA][/D=destWaveA][,yWaveB[/X=xWaveB][/D=destWaveB][,...]]

第2章

2.1.1

make/N=100/Ogaussfun,lorfun

setscale/Ix,-1,1,gaussfun,lorfun

gaussfun=exp(-x*x/0.01)

lorfun=1/((x*x)+0.04)

make/N=10XY_Y={4,6,8,4,6,7,9,1,4,3}

make/N=10XY_X={3,5,1,4,7,5,8,6,9,2}

Displaygaussfun

//绘制gaussfun曲线

DisplayXY_YvsXY_Xas“mygraph”

//绘制XY曲线并且设定graph标题为mygraph

Display/L=newLeft/B=NewBottomgaussfunas"

mygraph"

//以新建自由坐标轴newLeft和NewBottom绘制gaussfun曲线。

Preferences0;

Display/L=newLeft/B=NewBottomgaussfunas"

;

Graph1Style();

Preferences1;

//以新建坐标轴newLeft和NewBottom为坐标轴绘制gaussfun曲线,并采用预定义样式Graph1Style。

2.1.2

AppendToGraph/L=newLeft/B=newBottomlorfun

//向当前graph添加lorfun,坐标轴为newLeft和newBottom。

AppendToGraph/W=Graph0lorfun//向名为“Graph0”的窗口添加lorfun曲线

2.2.2Make/N=50sinx,cosx;

//创建两个wave

Setscale/Ix,0,2*pi,sinx,cosx;

//设置两个wave的x坐标为0到2π

Sinx=sin(x);

//设置wavesinx为它的横坐标的正弦

Cosx=cos(x);

//设置wavecosx为它的横坐标的余弦

Make/N=(50,2)arrowinfo;

//创建Arrowinfo信息wave

Setscale/Ix,0,2*pi,arrowinfo;

//设置Arrowinfowave的x坐标为0到2π,代表一圈

Arrowinfo[][0]=10;

//设置所有的箭头长度都是10;

Arrowinfo[][1]=x;

//设置随着角度的增加箭头偏转的方向

Displaysinxvscosx;

//显示sinx,并且以cosx为横坐标

ModifyGrapharrowMarker(sinx)={arrowinfo,1,5,0.5,1}

//设置Marker为Arrow。

这一步可以也可以通过曲线//外观设置对话框设置箭头marker完成,注意Arrow//Info要选择arrowinfo

Make/N=100datax,datay,dataz

datax=enoise

(2);

datay=enoise

(2);

dataz=exp(-(datax^2+datay^2))

Displaydatayvsdatax;

ModifyGraphmode=3,marker=8

ModifyGraphzmrkSize(datay)={dataz,*,*,1,10}

2.2.3

make/Odata

setscale/Px0,1,data

data=exp(-x/60)

displaydata

ModifyGraphmanTick(bottom)={0,30,0,0},manMinor(bottom)={3,2}

make/OInverseTemperature={30,20,14.2857,10,5,3.0303,2.22222,1.25}

make/OMobility={0.211521,0.451599,0.612956,0.691259,0.886406,0.893136,0.921083,1}

DisplayMobilityvsInverseTemperature//绘制曲线,使用默认坐标轴

ModifyGraphmode=3,marker=8

make/N=5/TTickLable={“20”,”30”,”50”,”100”,”400”}//刻度线标签

make/N=5TickPosition

TickPosition=450/str2num(TickLable)

ModifyGraphuserticks(bottom)={TickPosition,TickLable}

2.2.4

make/Ogaussdata

setscale/Ix,-1,1,gaussdata

gaussdata=gauss(x,0,0.2)

displaygaussdata

ModifyGraphzColor(gaussdata)={gaussdata,*,*,Rainbow256,0}

ModifyGraphmode=4,marker=19

ModifyGraphmskip=5

TextBox/C/N=text0/D={2,2,0}/A=MC"

\\JC\\Z15\\F'

TimesNewRoman'

GaussFunction\re\\S(-x\\S2\\M\\Z14\\S/2\\F'

symbol'

s\\F'

\\S2\\M\\Z14\\S)"

Twice\{K0}is\{K0*2}

\{"

TwiceK0is%g,andtodayis%s"

2*K0,date()}

\{“xvalue=%g”,tagval

(2)}//输出x的大小,每一个参数表示一种预定义类型

\{“meanvalue=%g”,mean(tagwaveref(),-inf,+inf}//输出引用wave的平均值,tagwaveref返回wave的引用。

2.4.3

make/O/N=(128,128)gaussdata=gauss(x,64,10,y,64,10)

functionxyzcontour()

make/O/N=(100,3)xyzwave

variablei

for(i=0;

i<

100;

i+=1)

xyzwave[i][0]=gnoise

(1)

xyzwave[i][1]=gnoise

(1)

xyzwave[i][2]=gnoise

(1)

endfor

display;

appendxyzcontourxyzwave

end

2.4.5

Make/O/N=(200,30)fdfun;

Setscale/Ix,-1,0.2,fdfun;

fdfun=1/(exp(x*1.6*10000/1.38/30)+1);

duplicate/Ofdfun,lorfun1,lorfun2;

lorfun1=0.005/((x+0.1)^2+0.01);

lorfun2=0.008/((x+0.3)^2+0.01);

fdfun=fdfun+lorfun1+lorfun2

newwaterfallfdfun;

//绘制waterfall图

Newwaterfall/Host=graphnamewavename

2.4.6

Duplicate/Ofdfunfdcolor;

Fdcolor=y;

ModifyGraphzColor(fdfun)={fdcolor,*,*,Rainbow256,0};

Modifywaterfallangle=45

2.4.7

Make/N=(100,100)gaussfun;

Setscale/Ix,-0.5,0.5,gaussfun;

Gaussfun=exp(-x*x/0.04-y*y/0.04);

2.5.2

make/O/N=(100,100)data

setscale/Ix,-pi,pi,data

data=sin(x)*cos(y)

make/O/N=(20,20,3)dsphere

setscale/Ix,0,pi,dsphere

setscale/Iy,0,2*pi,dsphere

dsphere[][][0]=1*sin(x)*cos(y)

dsphere[][][1]=1*sin(x)*sin(y)

dsphere[][][2]=1*cos(x)

NewGizmo/N=Gizmo0/T="

Gizmo0"

ModifyGizmostartRecMacro

AppendToGizmoSurface=root:

dsphere,name=surface0

ModifyGizmoModifyObject=surface0property={surfaceColorType,1}

ModifyGizmoModifyObject=surface0property={fillMode,3}

ModifyGizmoModifyObject=surface0property={srcMode,4}

ModifyGizmoModifyObject=surface0property={frontColor,0.250004,0.996109,0.250004,1}

ModifyGizmoModifyObject=surface0property={backColor,0.996109,0.664073,0,1}

ModifyGizmosetDisplayList=0,object=surface0

ModifyGizmoSETQUATERNION={0.488416,0.302182,0.455614,0.680110}

Make/O/N=(20,3)data=gnoise(5)

data[][2]=2*data[p][0]-3*data[p][1]+data[p][0]^2+gnoise(0.05)

make/N=(100,100)/Odata

setscale/Ix,-2,2,data

setscale/Iy,-2,2,data

data=gauss(x,-1,0.5,y,-1,0.5)+gauss(x,-1,0.5,y,1,0.5)

data=data+gauss(x,1,0.5,y,-1,0.5)+gauss(x,1,0.5,y,1,0.5)

第3章

3.1.2

Make/O/N=100trialwave;

Setscale/Ix,-1,3,trialwave;

Trialwave=exp(-0.1*x)+gnoise(0.02);

Displaytrialwave;

ModifyGraphmode=3;

functionfitfun(coef,x):

Fitfunc

wavecoef

variablex

<

Exressions>

make/Ocoef={a1,a2,a3,…}

funcfitfitfun,coef,ydata/D

3.1.3

make/OLorF

setscale/Ix,-10,10,LorF

setrandomseed0.5

LorF=1/(x*x+1)+gnoise(0.05)

displayLorF

3.1.5

Make/O/N=(200,200)w2d

ModifyGraphlsize(fit_LorF)=2,rgb(fit_LorF)=(0,0,65280)

3.2.2

Makew

f(x)=a*x*x+b*x+c

Make/O/N=200trialdata

Setscale/Px,-2,0.02,trialdata

Setrandomseed0.5

Trialdata=x*x-2*x-1+gnoise(0.2)

Displaytrialdata

ModifyGraphmode=3,marker=8,rgb=(0,0,65280)

3.2.4

Functionf(w,x):

FitFunc

Wavew

Variablex

End

Functionf(w,x,y):

Variabley

//functionbody

3.3.1

CurveFit[flags]fitType,[kwCWave=coefWaveName,]waveName[flagparameters]

CurveFitfitTypewavename

Make/O/N=20trialdata

Setscale/Ix,0,10,trialdata

Trialdata=exp(-4*(x-5)^2)

Modifygraphmode=3,marker=8

VariableV_FitOptions=8//controlfitting

Curvefitgausstrialdata

EditM_iterates

K0=1;

K1=2;

K2=3;

K3=4

CurveFit/Ggausstrialdata

Setscale/Ix0,5,trialdata

Trialdata=exp(-(x-2)/2)+gnoise(0.1)

Curvefit/TBOX=768exp_Xoffsettrialdata/D

Curvefit/K={2}/TBOX=768exp_Xoffsettrialdata/D

SetAxisleft0,4

SetAxisbottom-1,8

Curvefit/X/TBOX=896exp_Xoffsettrialdata/D

make/O/N=20trialdata

setscale/Ix,0,2,trialdata

setrandomseed0.5

trialdata=exp(-x)+gnoise(0.1)

displaytrialdata

modifygraphmode=3,marker=8

Curvefit/TBOX=768exptrialdata/D/F={0.95,6,ErrorBar}

Setscale/Ix,0,2,trialdata

Trialdata=2*exp(-x)+gnoise(0.3)

Curvefit/W=0linetrialdata/D/R

3.3.3

Make/O/N=200data1

Setscale/Ix,0,2*pi,data1

Data1=2*sin(x)+gnoise(0.2)

Displaydata1

K1+K2>

3

K3/5<

2*K1

K1*K1<

2。

-1000

1000

0-100

0100

00-10

0010

000-1

0001

K0,K1,K2,K3

1,1,0,3,0,2,1,1

EditM_FitConstraint,W_FitConstraintwave

3.4.1

FunctionFitEllipse(w,x,y):

//w[0]=a

//w[1]=b

//w[2]=x0

//w[3]=y0

//equition:

x^2/a^2+y^/b^2=1

Return(x-w[2])^2/w[0]^2+(y-w[3])^2/w[1]^2-1

Make/O/N=20theta,ellipseX,ellipseY

Theta=2*pi/20*p

ellipseX=2*cos(theta)+2

ellipseY=3*sin(theta)+1

DisplayellipseYvsellipseX

Modifygraphmode=3,marker=8

Modifygraphwidth={perUnit,72,bottom},height={perUnit,72,left}

ellipseX+=gnoise(.3)

ellipseY+=gnoise(.3)

Duplicate/OellipseY,ellipseYFit,ellipseXFit

Make/D/OellipseCoefs={3,2,1,2}//a,b,x0,y0

FuncFit/ODR=3FitEllipse,ellipseCoefs/X={ellipseX,ellipseY}/XD={ellipseXFit,ellipseYFit}

AppendToGraphellipseYFitvsellipseXFit

Make/O/N=(100,100)elllipseContour

SetScale/Ix-3,4.5,elllipseContour

SetScale/Iy-3,5,elllipseContour

elllipseContour=FitEllipse(ellipseCoefs,x,y)

AppendMatrixContourelllipseContour

ModifyContourelllipseContourlabels=0,autoLevels={*,*,0},moreLevels=0,moreLevels={0}

ModifyContourelllipseContourrgbLines=(0,0,0)

3.4.2

Make/O/N=20data1

Setscale/Ix,-2,2,data1

Data1=abs(x)+gnoise(0.1)

Modifygraphmode=3,marker=8

Functionmyfit(w,x):

If(x>

=0)

Returnw[0]+w[1]*x

Endif

If(x<

0)

Returnw[2]-w[3]*x

Make/O/N=4co

Co={0,1,0,1}

FuncFit/W=0/NTHR=0myfit,co,data1/D

3.4.3

Functionmyfitfunc(pw,yw,xw):

Wavepw,

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

当前位置:首页 > 高等教育 > 艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1