Yes i have modified the code. The following is what the actual code is. And i have attached the error message also.
- function [ Tau_Los, CRLB_Theta_SP ] = Maximum_Likelihood_detector(D)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% Tau_Los =0; Tau_Dmc = 0; Beta = 0; Alpha1 = 0; Alpha0 = 0;
Mf = 4095; f0 = 1/Mf; n = 5;
% Theta_SP = [Tau_Los];
% Theta_Dmc = [Tau_Dmc Beta Alpha1]’;
% Theta_Noise = [Alpha0];
cvx_expert true
cvx_begin gp
cvx_solver sedumi
variable Theta(n) ;
% Theta = exponential;
[ val, Rnn_Theta_Dan ] = RIMAX_CostFcn(D,Theta, Mf,f0);
minimize(val);
cvx_end
Tau_Los = Theta(1);
mf = (-ceil(Mf-1)/2):1:(ceil(Mf-1)/2);
D_Theta_SP = (-2jpif0mf’).exp( -2jpif0*mf’*Tau_Los);
CRLB_Theta_SP = 0.5*real(D_Theta_SP’*inv(Rnn_Theta_Dan)*D_Theta_SP);
end
- function [ val, Rnn_Theta_Dan ] = RIMAX_CostFcn(D,Theta, Mf,f0)
%MINIMIZE Summary of this function goes here
% Detailed explanation goes here
% TODO: add validation
% display(Theta);
display(size(Theta));
Theta_SP = Theta(1);
Tau_Dmc = Theta(2);
Beta = Theta(3);
Alpha1 = Theta(4);
Theta_Dmc = [Tau_Dmc Beta Alpha1]';
Alpha0 = Theta(5);
mf = (-ceil(Mf-1)/2):1:(ceil(Mf-1)/2);
% S_Theta_SP = cos(2pimf’f0Theta_SP) - 1jsin(2pimf’f0Theta_SP);
S_Theta_SP = exp(-1j2pimf’f0Theta_SP);
% Theta_SP = double(Theta_SP);
% x = -2pimf’f0Theta_SP;
% p =[0.5 1 1];
% S_Theta_SP = 1 + x;
% S_Theta_SP = 1 + x; %+ ((x.^2)/2);
R_Theta_Dmc = RTD(Theta_Dmc, Mf, f0);
% [c, r] = RTD(Theta_Dmc, Mf, f0)
Rnn_Theta_Dan = R_Theta_Dmc + Alpha0eye(Mf);
% Rnn_Theta_Dan = toeplitz(c,r) + Alpha0eye(Mf);
val = (D.’-S_Theta_SP)‘inv(Rnn_Theta_Dan)(D.’-S_Theta_SP);
validateattributes(val,{'numeric'},{'real','nonnegative','scalar','finite'});
end
- function [ R_Theta_Dmc] = RTD( Theta_Dmc, Mf, f0)
%RTD Summary of this function goes here
% Detailed explanation goes here
Tau_Dmc = Theta_Dmc(1,1);
Betad = Theta_Dmc(2,1);
Alpha1 = Theta_Dmc(3,1);
C = cvx(zeros(Mf,1)); R = cvx(zeros(1, Mf));
% d1=cvx(zeros(sz1,sz2));
for rcf = 1:Mf
x1 = -2jpi(+(rcf-1)0.5)f0Tau_Dmc;
% p =[0.5 1 1];
% e1 = 1 + x1;
C(rcf,1) = (Alpha1/(Betad + 2jpi*(+(rcf-1)/2)*f0))*exp(x1);
% cvx_begin
% C(rcf,1) = (Alpha1);
% cvx_end
x2 = -2pi(-(rcf-1)0.5)f0Tau_Dmc;
% p =[0.5 1 1];
% e2 = 1 + x2;
R(1,rcf) = (Alpha1/(Betad + 2jpi*(-(rcf-1)/2)*f0))*exp(x2);
% rcf_count = rcf
end
% szc = size©
% szr = size®
R_Theta_Dmc = toeplitz(C,R);
%variable R_Theta_Dmc(5,5) toeplitz
end
- The error message when these 3 functions are run in cvx:
Error using .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {complex
affine} .* {log-affine}
Error in * (line 36)
z = feval( oper, x, y );
Error in RIMAX_CostFcn (line 20)
S_Theta_SP =
exp(-1j2pi*mf’f0Theta_SP);
Error in Maximum_Likelihood_detector (line 22)
[ val, Rnn_Theta_Dan ] =
RIMAX_CostFcn(D,Theta, Mf,f0);
- this is the final code and the error message pasted corresponds to it on debugging mode.
Thank you