% Caller for Seed Dispersal function Xt = seed_v_w(v_e, beta_p, lambda_p, X0) if (nargin < 4) v_e = 1; % wind speed average [m/s]. Default value % The term ±β v_e − v_w(t) represents the probability associated with % drift toward the mean wind speed of v_e. beta_p = 0.1; % λ∆t represents the probability associated with random diffusion of the wind speed lambda_p = 0.2; X0 = 0; end % Constants T = 500; N = 2^10; dtMult = 1; prec = 2; % decimal precion just for legend % --- Wind speed SDE calculation % SDE linear: dX = c1*X dt + sigma1*X dW % f(t,Xt) = c1 Xt + c2 % g(t,Xt) = sigma1 Xt + sigma2 f = @(c1X, c2) (c1X + c2); g = @(sigma1X, sigma2) (sigma1X + sigma2) name = "Euler–Maruyama linear - Xt: Wind speed" fprintf("Executing: %s", name); dimSystemEq = 1; legend_str = [ strcat("Wind speed - Wind speed average v_e=", num2str(v_e, prec)," [m/s], /beta=", ... num2str(beta_p, prec), ", /lamba=", num2str(lambda_p)) ]; st.c1X = @(x) (2*lambda_p*beta_p*(v_e-x) ); st.c2 = 0; st.sigma1X = @(x) ( sqrt(2*(lambda_p^2)*lambda_p) ); % x is ignored st.sigma2 = 0; % Resolve EM method Xt = EM_linear(name, f, g, st, X0, T, N, dtMult, dimSystemEq, legend_str); end