時域波形的參數(shù)測量實驗報告s_第1頁
時域波形的參數(shù)測量實驗報告s_第2頁
時域波形的參數(shù)測量實驗報告s_第3頁
時域波形的參數(shù)測量實驗報告s_第4頁
時域波形的參數(shù)測量實驗報告s_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀

付費下載

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

時域測試技術(shù)綜合實驗報告書實驗名稱時域波形的參數(shù)測量實驗班級一班學(xué)號201422070125姓名楊梅實驗時間:年月日得分:實驗?zāi)康?.學(xué)習(xí)VISUALDSP++開發(fā)流程。2.掌握波形時域參數(shù)(周期、上升時間等)的測量方法。3.掌握波形幅度參數(shù)(幅度、平均值、均方根值等)的測量方法。4.掌握參數(shù)統(tǒng)計的一般實現(xiàn)方法。實驗內(nèi)容1.學(xué)習(xí)VisualDSP++的開發(fā)設(shè)計流程。2.編寫程序測量波形參數(shù)。3.編寫程序?qū)Σㄐ螀?shù)進行統(tǒng)計運算。實驗步驟1、計算并顯示示波器幅度參數(shù):平均值、有效值。打開Ypara.c源文件,填充缺少的代碼。intGetAverage(short*pBuffer,intLength){ intSum=0; inti; for(i=0;i<Length;/*inputyourcode*/i++){Sum+=*pBuffer;/*inputyourcode*/pBuffer++;}returnSum/Length;/*inputyourcode*/}floatGetRMS(short*pBuffer,intLength,intZeroValue){ floatSum=0; inti; for(i=0;i<Length;i++){ longtemp; temp=pBuffer[i]-ZeroValue;/*inputyourcode*/ temp*=temp;/*inputyourcode*/ Sum+=temp; }Sum/=Length;returnsqrt(Sum)+ZeroValue; /*inputyourcode*/}2、計算并顯示示波器幅度類參數(shù):頂值、底值。打開Ypara.c源文件,填充缺少的代碼。intGetTop(short*pBuffer,intLength){ shortmidpoint,toppoint,i; midpoint=GetAverage(pBuffer,Length); toppoint=GetMax(); i=toppoint; GetCount(*pBuffer,Length); do { i--; if(tmpbuffer[i]>tmpbuffer[toppoint]) toppoint=i; }while(i>midpoint); //修正 if(tmpbuffer[toppoint]<Length*0.05) toppoint=GetMax(); returntoppoint;/*inputyourcode*/ //return1;}intGetBase(short*pBuffer,intLength){ shortmidpoint,basepoint,i; midpoint=GetAverage(pBuffer,Length); basepoint=GetMin(); i=basepoint; GetCount(*pBuffer,Length); do { i++; if(tmpbuffer[i]>tmpbuffer[basepoint]) basepoint=i; }while(i<midpoint); //修正 if(tmpbuffer[basepoint]<Length*0.05) basepoint=GetMin(); returnbasepoint; /*inputyourcode*/ //return1;}3、計算并顯示示波器時間類參數(shù):上升時間。打開Xpara.c源文件,填充缺少的代碼。intGetRising(short*pBuffer,intLength,intyPer10,intyPer90,int*pxPer10,int*pxPer90){ intIndex=0; while(Index<Length&&pBuffer[Index]>yPer10/*inputyourcode*/) Index++; while(Index<Length&&pBuffer[Index]<=yPer10/*inputyourcode*/) Index++; intxPer10=0; if(Index<Length) xPer10=Index; while(Index<Length&&pBuffer[Index]<yPer90/*inputyourcode*/) Index++; intxPer90=0; if(Index<Length) xPer90=Index; *pxPer90=xPer90; *pxPer10=xPer10; return1;}3、對代碼進行測試(打開參數(shù)測量功能),并填寫如下表格:輸入波形平均值均方根值上升時間1KHz正弦波(偏移1V,幅度600mV)1.1v1.64v142us1KHz方波(偏移100mV,幅度600mV)82mv680mv18us1KHz三角波(偏移0V,幅度1.2V)12mv1.22v284us4、新建文件Statistic.c和Statistic.h,并將其加入工程中。在Statistic.c文件中對平均值和周期兩個參數(shù)進行統(tǒng)計運算,并填寫如下表格。(1)在Statistic.c文件中的參數(shù)統(tǒng)計算法:intGetAverage(short*pBuffer,intLength){ intSum=0; inti; for(i=0;i<Length;/*inputyourcode*/i++){Sum+=*pBuffer;/*inputyourcode*/pBuffer++;}returnSum/Length;/*inputyourcode*/}intGetPeriod(short*pBuffer,intLength,intyPer10,intyPer90,int*pxFirst,int*pxLast){intFirstR10,FirstR90,FirstMid; GetRising(pBuffer,Length,yPer10,yPer90,&FirstR10,&FirstR90); FirstMid=(FirstR10+FirstR90)/2; intFirstF10,FirstF90,SecondMid; GetFalling(pBuffer,Length,yPer10,yPer90,&FirstF10,&FirstF90); SecondMid=(FirstF10+FirstF90)/2; intThird10,Third90,ThirdMid; if(FirstMid>SecondMid) { GetFalling(pBuffer+FirstR90,Length-FirstR90,yPer10,yPer90,&Third10,&Third90); *pxFirst=SecondMid; ThirdMid=(Third10+Third90)/2+FirstR90; } else { GetRising(pBuffer+FirstF10,Length-FirstF10,yPer10,yPer90,&Third10,&Third90); *pxFirst=FirstMid; ThirdMid=(Third10+Third90)/2+FirstF10; } *pxLast=ThirdMid; return1; /*inputyourcode*/ *pxFirst=50; *pxLast=100; return1;}實驗表格輸入波形平均值均方根值上升時間1KHz正弦波(偏移1V,幅度600mV)1.1v1.64v142us1KHz方波(偏移100mV,幅度600mV)82mv680mv18us1KHz三角波(偏移0V,幅度1.2V)12mv1.22v284us實驗思考題1、如何提高波形測量的精度? 答:主要有兩種方法,其一是減少測頻量化誤差,即增加測量時間(主門時間)的方法;其二是減小側(cè)周量化誤差,即采用多周期測量法,在這里不再贅述。此外,為了提高測量的準(zhǔn)確度,比較常用的方法還有游標(biāo)法、內(nèi)插法、平均測量技術(shù)、多周期同步測量法、相檢寬帶測頻技術(shù)以及量化時沿法。 完善波形周期、幅度值的測量算法。答:intGetPeriod(short*pBuffer,intLength,intyPer10,intyPer90,int*pxFirst,int*pxLast){intFirstR10,FirstR90,FirstMid; GetRising(pBuffer,Length,yPer10,yPer90,&FirstR10,&FirstR90); FirstMid=(FirstR10+FirstR90)/2; intFirstF10,FirstF90,SecondMid; GetFalling(pBuffer,Length,yPer10,yPer90,&FirstF10,&FirstF90); SecondMid=(FirstF10+FirstF90)/2; intThird10,Third90,ThirdMid; if(FirstMid>SecondMid) { GetFalling(pBuffer+FirstR90,Length-FirstR90,yPer10,yPer90,&Third10,&Third90); *pxFirst=SecondMid; ThirdMid=(Third10+Third90)/2+FirstR90; } else { GetRising(pBuffer+FirstF10,Length-FirstF10,yPer10,yPer90,&Third10,&Third90); *pxFirst=FirstMid; ThirdMid=(Third10+Third90)/2+FirstF10; } *pxLast=ThirdMid; return1; /*inputyourcode*/ *pxFirst=50; *pxLast=100; return1;}intGetAmplitude(sho

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論