matlab构造连加的函数

% sda6_11_a1
clear all;
z_array = [0 6 12 18] .* 1e-6;
n_array = [1880 940 530 305];
num = 4.;
g = 9.8;
delta_rho = 63.;
T = 293.;
r = 0.52e-6;
A = 4 * pi * r ^ 3 * delta_rho * g / (3 * T);
syms nu0 k
func_str = '@(nu0, k)';
for i = 1:4
    t1 = n_array(i) .* (log(nu0) - A .* z_array(i) ./ k) - nu0 .* exp(- A .* z_array(i) ./ k);
    t2 = sprintf('%s', t1);
    func_str = strcat(func_str, t2);
    if i < 4
        func_str = strcat(func_str, '+');
    end
end
f2 = str2func(func_str);

猜你喜欢

转载自www.cnblogs.com/feifei2015/p/12940640.html