run s3p2ab_template

% generating channel coefficients
randn('state', 17);
h = randn(n, 1);

% noise power
noise_power = 1;

% precision of interpolation
r = [0 3 6 9 12 15]; % we evaluate the power function at these points

% initialize slopes and constants of the linear pieces
a = zeros(n, length(r) - 1); % slopes
c = zeros(n, length(r) - 1); % constants


for j = 1 : n % over all edges

    for i = 2 : length(r) % over all intervals
        
        % calculate slopes and constants here %
        
    end

end

% range for observing the approximated function
xp = 0 : 0.1 : 15;

% choose one of the power-rate functions
j = 1; % here, we chose the first one

for rate_idx = 1 : length(xp)
    rate = xp(rate_idx);
    
    truef(rate_idx) = % calculate true function value here %
    appf(rate_idx) = % calculate approximated function value here %

end

plot(xp, truef, xp, appf)
legend('True power function','Affine approximation');