測樹學weibull擬合matlab程式,難者不會,會者不難

來源:互聯網
上載者:User

function [N,k,x,dbh,n_fit parmhat, parmci]=WblDbh(n,a,W)
% 根據整化的徑階,進行weibull擬合
% n : 徑階株數
% dbh : 各株的胸徑大小
% N 株數
% k 徑階數
% x 徑階胸徑
% n_fit 各徑階擬合值
% parmhat, parmci weibull擬合結果

%W = 1; %徑階距
%a = 6; %起測胸徑
dbh = [];
for i = 1:length(n)
  
    %tmp = GetDbhFrom(i,a,W)*ones(n(i),1);
    tmp = GetDbhFrom(i,0,W)*ones(n(i),1);
    dbh = [dbh;tmp];
end
N = length(dbh);
k = length(n);
%dbh = dbh - a;  % 起測胸徑平移
[parmhat parmci]= wblfit(dbh);
A=parmhat(1)
B=parmhat(2)
%figure();
f=k-3-1; %自由度
%x = W/2: W : k*W; %徑階中值
x = GetDbhFrom([1:k],0,W);
%x = GetDbhFrom([1:k],a,W);
%各徑階理論株數;
n_fit=round( N*W*B/A*power(x/A,B-1).*exp(-1*power(x/A,B)));
%n_fit = round( N*W * wblpdf(x, A,B));
figure;
plot(x +a,n,'*',x+a ,n_fit,'-o');
%chi-test
end

 

function dbh = GetDbhFrom(i,a,W)
%W = 1; %徑階距
%a = 6; %起測胸徑
%dbh 第i徑階的胸徑

dbh = W/2 + a + (i-1)*W;
end

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.