writer these functions █(e[ρ(τ)]={■(ρ,&τ⟶0,@θ,&τ,κ⟶∞;)┤@var⁡[ρ(τ)]={■(0,&τ⟶0,@0,&τ,κ⟶∞,@σ^2 ρτ,&κ⟶0.)┤ ) in matlab

You can write these functions in Matlab using the following code:

main.m
function e = function_e(rho, var)
    syms t k theta;
    e = subs(rho, t, 0) + theta*int(exp(-k*t)*subs(var, t, k), k, 0, Inf);
end

function var = function_var(sigma, rho)
    syms t k;
    var = subs(rho, t, 0)*(sigma^2);
    var = var + sigma^2*int(exp(-2*k*t)*subs(rho, t, k), k, 0, Inf);
end
298 chars
11 lines

Note that these functions use the symbolic toolbox in Matlab, which allows for symbolic computation. You can call these functions on any symbolic expressions, such as syms t; rho = t^2; var = t^3; e = function_e(rho, var);.

related categories

gistlibby LogSnag