?? test.m
字號:
close all;clear;load outside.txt; %調(diào)入外部數(shù)據(jù)文件f=outside(:,1); %取圖像信號數(shù)據(jù)faverage=mean (f); %求均值fstd=std(f); %求標準差a=min(f); %最小值b=max(f); %最大值xx=(a-2):0.05:b+2; p=normpdf(xx,faverage,fstd); %理論正態(tài)分布函數(shù)h=normcdf(xx,faverage,fstd); %理論累計概率count=0;for i=a:0.1:b count=count+1; aa=find(f==i); F(count)=length(aa)/length(f); %統(tǒng)計各數(shù)據(jù)值出現(xiàn)的概率endc=sum(F); %統(tǒng)計實驗累計概率for j=1:length(F) d(j)=sum(F(1:j))/c; endfigure(1) set(1,'Position',[10,100,500,400]) %設(shè)定窗口位置及大小 figure(2) set(2,'Position',[550,100,500,400]) %設(shè)定窗口位置及大小 figure(1)t=linspace(a,b,length(F));plot(t,d,'*') %畫實驗概率累積分布曲線hold onplot(xx,h,'r') %畫理論概論累積分布曲線xlabel('電平值/( -dbmw)') %畫理論概率密度函數(shù)ylabel('概率累積值')title('概率累積分布圖')figure(2)hist(f,(b-a)*10); %畫頻數(shù)直方圖hold onplot(xx,p*100,'r');xlabel('電平值/( -dbmw)') %畫理論概率密度函數(shù)ylabel('概率密度值')title('概率密度分布圖')
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -