Как создать точечную матрицу поверхности и изображения для системы ODES с переменным параметром в matlab - PullRequest
0 голосов
/ 07 апреля 2020

всех.

Я хотел бы сделать две графики, сначала поверхность, а затем точечную матрицу изображения для следующей системы од.

enter image description here

код функции следующий:

function [H, h, ZH, Zh, Z] = funcHhZHZhZ(varrhoH1)

clear all;
close all;
clc;
%
tic;
rand('state',sum(100*clock)); % seed
%

numreps=2; % Number of iterations
for j=1:numreps
  options = odeset('RelTol',1e-6,'Stats','on');  
% Parameters values of adults and tadpoles

    % Fecundity (number of new individuals)
    aH = 800; % minimum number offsprings 
              % per each host adults per year
              % Mitchell 2008

    % Metamorphosis rate
    ah = 0.16; % Metamorphosis rate per year
               % Mitchell 2008

    % Natural dead hosts whitout infection 
    bH =  0.73;% Natural mortality rate in adults 
                % per year Mitchell 2008

    bh = 7.55; % Natural mortality rate in adults 
               % per year Mitchell 2008

    % Host mortality due to infection 
    alphaH = 0.001; % Mortality rate per adult host 
                    % per unit time due to infection 
                    % this work

    alphah = 3.25;  % Mortality rate per adult host 
                    % per unit time due to infection 
                    % this work

    % Natural mortality zoospores within hosts
    muH = 117*52; %83.66;%117*52; % Natural mortality in zoospores 
                  % in adults Woodhams 2008 at an 
                  % average temperature 17.38 per year

    muh = 117*52;%83.66;%117*52; % Natural mortality in zoospores 
                  % in adults Woodhams 2008 at an 
                  % average temperature 17.38 per year

    %zoospore release rate
    lambdaH = 1*10^5; % Release rate of new zoospores 
                        % within the body of the tadpole 
                        % host to the pool per year Mitchel 2008

    lambdah = 6.6*10^6; % Release rate of new zoospores 
                        % within the body of the tadpole 
                        % host to the pool per year Mitchel 2008

    % Zoospores recruitment rate within host
    rH = 124*52; % Maximum birth rate of new zoospores
                 % within the pre-adult host body 
                 % per unit time Woodhams et al 2008

    rh = 124*52; % Maximum birth rate of new zoospores
                 % within the pre-adult host body 
                 % per unit time Woodhams et al 2008

    % Zoospores transmission rate since pool 
    % Mitchell 2008
    betaH = 6*10^-9; % Rate of transmission of a spore
                     % to an individual per year
                     % Mitchell pre-adult 2008 

    betah = 6*10^-9; % Rate of transmission of a spore
                     % to an individual per year
                     % Mitchell pre-adult 2008 

   % Recapture factor of spores that are released by 
    % sporangium from the skin of the hosts
    varrhoH1 = 10^-2;
    varrhoH = varrhoH1*lambdaH; % Proportion of zoospores 
                                % that are immediately absorbed into 
                                % the skin of adult hopederos, 
                                % who depend on the zoospores released 
                                % by sporangiumos sporangios
    varrhoh1 = 10^-2;                                       
    varrhoh = varrhoh1*lambdah; % Proportion of zoospores 
                                % that are immediately absorbed into 
                                % the skin of adult hopederos, 
                                % who depend on the zoospores released 
                                % by sporangiumos sporangios

   % Maximum absorption factor of 
   % zoospores by host values taken 
   % from Woodhams 2008
     phiH = 10^4;  % Inverse absorption factor 
                   % per host, if low 
                   % absorption is high and viceversa

     phih = 10^4;  % Inverse absorption factor 
                   % per host, if low 
                   % absorption is high and viceversa

    % Natural mortality of zoospores into the pool 
    muZ = 45*52; % Tasa de mortalidad natural 
                % de la zoosporas Castro 2015 
                % por año

    % Carrying capacity of species
    KH = 10^5; % adults host
    Kh = 10^5; % tadpoles host


    %x(1) = H; x(2) = h; x(3) = ZH; 
    %x(4) = Zh; x(5) = Z;

    G = @(t, x, ah, aH, bh, bH, muh, muH, alphah, ...
        alphaH, lambdah, lambdaH, rh, rH, phih, phiH, ...
        varrhoh, varrhoH, muZ, betaH, betah, Kh, KH) ...
        [ah *  x(2) * exp(-Kh * x(2)) - bH * x(1) - alphaH * x(3); ...
        aH * x(1) - (bh + ah * exp(-Kh * x(2))) * x(2) - alphah * x(4); ...
        rH * x(3) * exp(-phiH * x(3)) + lambdaH * x(3) * (x(1)./(varrhoH + x(1))) + x(5) * betaH * (x(1)./(x(1) + x(2))) - x(3) * (bH + muH) - alphaH * x(1) * (x(3)./x(1) + (x(3)./x(1))^2 * ((phiH + 1)./phiH)); ...
        rh * x(4) * exp(-phih * x(4)) + lambdah * x(4) * (x(2)./(varrhoh + x(2))) + x(5) * betah * (x(2)./(x(1) + x(2))) - x(4) * (bh + ah * exp(-Kh * x(2)) + muh) - alphah * x(2) * (x(4)./x(2) + (x(4)./x(2))^2 * ((phih + 1)./phih)); ...
        lambdaH * x(3) + lambdah * x(4) - x(5) * (muZ + betaH * (x(1)./(x(1) + x(2))) + betah * (x(2)./(x(1) + x(2))))-(lambdaH * x(3) * (x(1)./(varrhoH + x(1))) + lambdah * x(4) * (x(2)./(varrhoh + x(2))))];
    %tspan = [0:0.001:50];
    x0 = [100 100 10 10 500];
    [t,xa] = ode45(@(t,x) G(t, x, ah, aH, bh, bH, muh, muH, ...
        alphah, alphaH, lambdah, lambdaH, rh, rH, phih, phiH, ...
        varrhoh, varrhoH, muZ, betaH, betah, Kh, KH), ...
        [0 50], x0, options);

    H = xa(:,1)';
    h = xa(:,2)';
    Zh = xa(:,3)';
    ZH = xa(:,4)';
    Z = xa(:,5)';
    end 

Сначала я хотел бы создать поверхность, описывающую поведение каждого решения (H (t), h (t), ZH (t). , Zh (t), Z (t)), когда параметр (например, \varrho_{H_{1}}) варьирует известный интервал из десяти случайных чисел, скажем, (\varrhoH1 = 10^-2 * ((10^0 - 10^-4)*rand(10,1) + 10^-4)).

Аналогично этому рисунку

enter image description here

Я использовал приведенный ниже код для его генерации

% 1. Generate a random sample of the input parameters

% A sample of 10 random numbers for the parameters 
% lambdaH and mu in each known interval

%lambdaH =  (10^6 - 10^2).*rand(10,1) + 10^2;
%muH = (6*10^3 - 2*10^3).*rand(10,1) + 2*10^3;
varrhoH1 = 10^-2 * ((10^0 - 10^-4)*rand(10,1) + 10^-4);
%varrhoH1 = (10^-4:0.1:10^0);

% Array to store Monte Carlo outputs
HMC = [];
hMC = [];
ZHMC = [];
ZhMC = [];
ZMC = [];
% 2. Analyze (deterministically) each set of inputs in the sample
for i = 1:length(varrhoH1)
    [H, ZH, h, Zh, Z] = funcHhZHZhZ(varrhoH1(i));
    HMC = [HMC; H];
    hMC = [hMC; h];
    ZHMC = [ZHMC; ZH];
    ZhMC = [ZhMC; Zh];
    ZMC = [ZMC; Z];
end

Однако, Я думаю, что результат не правильный, так как это значение \varrho_ {H_ {1}} не оценивается правильно в функции. С другой стороны, поверхность должна иметь другую форму, то есть, если \varrho_ {H_ {1}} приближается к 10 ^ -4, решение должно затухать быстрее к значению 0, когда оно приближается к этому значению. Также на оси в \varrho_{H_{1}} должен быть конкретно указан диапазон значений интервала \varrho_{H {1}}

С другой стороны, я хотел бы сделать изображение, подобное этому

enter image description here

На этой диаграмме я надеюсь, что смогу построить график точек, в которых одновременно H (t) и ZH (t) <1, хотя бы один из них меньше 1, а другой нет, и, наконец, оба положительные. </p>

Я хочу описать вероятности постоянства или нет, когда два параметра меняются. Я пытаюсь написать код, но он дает мне ошибку

    %parameters
    muH = (2*10^3:1000:6*10^3);
    lambdaH = (10^2:4000:10^5);
    dotarray=cell(length(muH), length(lambdaH), 1);
    for i = 1:length(muH)
            for j = 1:length(lambdaH)
            H = prueba24marzo2020(muH(i), lambdaH(j));
            ZH = prueba24marzo2020(muH(i), lambdaH(j));
                if H(:) < 1.0; % here H(t) Should be < 1
                    if ZH(:) < 1.0; % here ZH(t) Should be < 1
                        dot = 45;
                    else
                        dot = 20;
                    end
                    dot=1;
                end
                dotarray(i,j)={dot};
             end
        end
    dotmatrix=cell2mat(dotarray(1:length(muH(i)), 1:length(lambdaH(j))));
        image(dotmatrix, 'XData', muH, 'YData', lambdaH);
xlabel muH, ylabel lambdaH;

Я хочу описать вероятности постоянства или нет, когда два параметра меняются. Я пытаюсь написать код, но он выдает ошибку.

...