将未知数量的载体存储到单元阵列中

时间:2014-10-22 20:48:36

标签: matlab

如何将所有向量s存储到单元格数组中,以便以后可以使用它。向量s的数量不是特定的,它取决于条件while sigma > sigma_min。任何人都可以帮助我吗?

A_pinv = A'* inv(A * A');
s  = A_pinv * X
sigma = 2*max(abs(s));
sigma_min = 0.0001;
sigma_decrease_factor = 0.5;

while sigma>sigma_min
    for i = 1:L
        delta = s.*exp(-abs(s).^2/sigma^2);
        s = s - 0.5*delta;
        s = s - A_pinv*(A*s - X);
    end


    sigma = sigma * sigma_decrease_factor;
end

1 个答案:

答案 0 :(得分:1)

我还没有测试过,但我认为它会起作用,

count = 0;
Data = {};
while sigma>sigma_min
count = count + 1;
     for i = 1:L
         delta = s.*exp(-abs(s).^2/sigma^2);
         s = s - 0.5*delta;
         s = s - A_pinv*(A*s - X);
     end
Data{count} = s;
sigma = sigma * sigma_decrease_factor;
end