MATLAB代做  | MATLAB代寫  | MATLAB有償編程
首 頁
當前位置:MATLAB代做|MATLAB代寫|MATLAB有償編程matlab源碼參考源碼matlab方面
基于matlab編程Copula程序多變量分析源碼        [↓跳到下載地址]
官方主頁:源碼共享網站:www.kggbzb.tw

聯系方式:客服QQ:1747812398 買代碼源碼軟件站,歡迎咨詢

運行環境:Win9X/2000/XP/2003/

源碼語言:簡體中文

源碼類型:源碼程序 - 參考源碼 - matlab方面

推薦星級:

更新時間:2016-04-05 22:32:45

源碼簡介

function globalExtinctionProb = metapop(tau)
%METAPOP A metapopulation simulation model
%   METAPOP(TAU) runs the metapopulation simulation described in the
%   November 2003 MATLAB News&Notes article, "Monte-Carlo simulation in
%   MATLAB using copulas".
%
%   Requires MATLAB?R13, including Statistics Toolbox?

% The metapopulation model will include 3 subpopulations, and weill run
% over 100 time steps (years).
npops = 3;
nyears = 100;

% In each time step, there's a 3% chance of extinction for each
% subpopulation, and a 25% chance that an active population will recolonize
% a locally extinct one.
probLocalExtinction = .03;
colonizationRate = .25;

% Compute the linear correlation parameter that will be needed for the
% Gaussian copula, as a function of the desired rank correlation in local
% extinctions.  By default, assume zero correlation.
if nargin == 0, tau = 0; end
if (tau < -1/3) || (1 < tau), error('TAU must be between -1/3 and 1.'); end
rho = sin(tau.*pi./2);

% Assume that the dependence in environmental variability between
% subpopulations is symmetric, i.e., equal correlations in local
% extinctions between all three pairs subpopulations.
R = [1 rho rho; rho 1 rho; rho rho 1];

% Run 10000 Monte-Carlo replicates in parallel.
nreplicates = 10000;

% Save a record of each subpopulation's presence/absence at each time step,
% for all the replicates.
presence = zeros(npops,nyears,nreplicates);
presence(:,1,:) = 1;
for yr = 2:nyears
    % Local extinctions occur at a given site with probability
    % probLocalExtinction, and are dependent between sites.  Model tht
    % dependence with a Gaussian copula.
    u = normcdf(mvnrnd([0 0 0], R, nreplicates));
    u = reshape(u',[npops,1,nreplicates]);
    localExtinction = (u < probLocalExtinction);
   
    % A local population remains active if it was active last year,
    % and it has not gone extinct this year.
    presence(:,yr,:) = presence(:,yr-1,:) .* (1 - localExtinction);
   
    % Count the number of local populations that are still active.
    nActivePops = sum(presence(:,yr,:), 1);
   
    % The probability that an extinct local population is recolonized
    % depends on the number of other local populations that are still
    % active.  Recolonizations are independent.
    probColonization = repmat(1 - (1 - colonizationRate).^nActivePops, [npops,1,1]);
    colonization = (rand(npops,1,nreplicates) < probColonization);
   
    % An extinct local population becomes active again if it is colonized.
    presence(:,yr,:) = presence(:,yr,:) + (1-presence(:,yr,:)).*colonization;
end

% The Monte-Carlo estimate of the probablility of global extinction is
% simply the number of replicates that went extinct diveide by the total
% number of replicates.
globalExtinctionProb = sum(all(presence(:,nyears,:) == 0, 1),3) ./ nreplicates

% Plot the subpopulation presence/absence for the first few replicates.
presence(presence==0) = NaN;
t = 1:nyears;
for i = 1:25
    subplot(5,5,i)
    plot(t,1.*presence(1,:,i),'r.', t,2.*presence(2,:,i),'b.', t,3.*presence(3,:,i),'m.');
end
 


提 示:本站所有源碼只提供瀏覽,需要定制的朋友可以聯系在線客服!
注意:價格根據項目的難易程度來定價格業務咨詢

基于matlab編程Copula程序多變量分析源碼 --下載地址

注意:為避免不必要的誤會,本站項目里的源碼只公開部分需要的聯系在線客服

本站長期招聘程序代寫高手,歡迎加入華南地區matlab團隊

想創業卻沒有經驗的人

無論你是否有過網上開店的經驗,都可以隨時聯系在線客服,建立自己獨立的網站
想開網店卻不知道如何入手

淘寶創業成本低而且風險小,如果想開淘寶店的朋友可以聯系在線客服。
想兼職創業,卻不擅長交際與服務的人

在家創業月入5000元。網站程序+百套群發工具+網賺資料+域名+空間+本站終身代理資格,這樣你網賺的條件全具備了。每天3小時管理、推廣、收錢。
缺乏能快速贏利型產品的人

導入多種最新流行營銷軟件+網賺教程,讓入駐者輕松加盟、復制有效成交技巧、快速賺錢。

源碼評論評論內容只代表網友觀點,與本站立場無關!

   評論摘要(共 0 條,得分 0 分,平均 0 分) 查看完整評論

瀏覽說明

* 本站所有源碼全部公開,隨時隨地瀏覽!
* MATLAB軟件如用于商業用途,請購買正版!
* 如果您發現下載鏈接錯誤,請點擊報告錯誤謝謝!
* 站內提供的所有軟件包含破解及注冊碼均是由網上搜集,若侵犯了你的版權利益,敬請來信通知我們!
Copyright © 2008-2014 www.kggbzb.tw. All Rights Reserved.
頁面執行時間:187.50000 毫秒
安微25选5开奖号