How do you tune two parameters to get the best results

Here are my codes, I really need help to tune the two regulation parameters to let re1 and re2 < 0.2, I have tried many many values, but still can’t get the optimal results of re1 and re2. Is there any method to search for proper regulation parameters?
> clc;clear;

        m = 128;
        n = m;
        ind_s = floor(m*0.05);
        ind_c = ind_s;
       x0 = zeros(n,1);
       x10_spt = randperm(n);
       x0(x10_spt(1:ind_c)) = randn(ind_c,1);
    
        % cor
        v0 = zeros(m,1);
        v0_spt = randperm(m);
        v0(v0_spt(1:ind_c)) = randn(ind_c,1);
        % Phi {+1, -1} Measurement
        Phi = 1/sqrt(m) * randn(m,n);
        % Noise
        %z = randn(n,1)*sqrt( sigmaSq );
        % y
        data = real(Phi * x0);

% data = real(Pauli * vec(x0));
% get the simulation measurement estimate value
N = 200;
p = (1+data)/2; % do a map to {(0,1) & 1}
s0 = rand(numel(data),N);
P = repmat(p,1,N);
s = P > s0; % the event: get +1
s1 = sum(s,2); % Determine how many +1s we got
s2 = s1/N;
edata = 2*s2-1; % map to original
% y = edata + noiseT + z;
y = edata + v0 ;
% m = 448, tau1 = tau2 = 0.05 is ok, re1 = 0.0631,re2 = 0.0622;
% then I change the measurement, hoping to get re = 0.0x

        tau1=10; 
        tau2=0.05;
       
       
        % Recovery via CVX
        cvx_begin quiet
            variable x(n) ;
            variable v(m);
       
            minimize 0.5*pow_pos(norm(y - Phi * x - v),2) + tau1 * norm(x,1) + tau2 * norm(v,1);              
            
        cvx_end
        re1 = norm(x - x0, 2)/ norm(x0, 2);
        re2 = norm(v - v0, 2)/ norm(v0, 2);

        re1
        re2

This forum is not the best place to get advice on formulating statistical models/procedures/optimization problems to support data analysis.

This looks basically like a LASSO problem. The choice of tau1 and tau2 can be critical. Maybe you want to try a 2D grid search for [tau1,tau2), and run CVX (LASSO) for each grid point. Of course, even there, you would need to choose bounds for the grid. Maybe there’s a better way, but this forum isn’t the right place to find out about it. And as to whether you should be splitting samples and doing some kind of Cross Validation. again, this is not the right place to hash that out.