function A = make_normal_random_matrix_specified_decay(m,n,S,mat_filename)
% makes a matrix of given dimensions and with singular values 
% specified by the diagonal matrix S, writes result to filename
    fprintf('making matrix..\n');
    p = min(m,n);
    if m >= n
       [U, temp] = qr(randn(m,n),0);
       [V, temp] = qr(randn(n));
    else
       [U, temp] = qr(randn(m));
       [V, temp] = qr(randn(n,m),0);
    end

    whos U S V
    A = (30*rand)*(U*S*V');

    fprintf('writing to mat file..\n');
    save(mat_filename,'A','S');
end
