Я очень новичок в Matlab и не могу преобразовать следующий код в c ++
предположим, что conv уже написан на C ++, я не знаю, реализует ли код 2D conv или 1D на самом деле
Как бы я преобразовал следующий код в C ++
% Description:
% Function that evaluates the equivalent loop transfer function from the
% loop integrator gain
%
% Input:
% KK [real,vector]: Integrator gains
% N [integer] : Order of the loop filter
% Output:
% A [real, vector]: Coefficients of the denominator
% B [real, vector]: Coefficients of the numerator
%
% Remarks:
% o A rate-only NCO is assumed
% construct the loop filter transfer function
v1 = 1;
v2 = 1;
B = zeros(1, N);
for ii = N:-1:1,
v1 = conv( v1, [1 -1] );
B = B + KK(ii)*[v2 zeros(1, ii - 1)];
v2 = conv(v2, [1 -1]);
end
v1 = conv( v1, [1 0]);
% Account for the rate-only NCO - Change this code to implement different
% NCO models
B = conv(B, [1 1])*1/2;
B = [ 0 B ];
A = v1 + B;