well I finally tried my muscles. There is some life in it but it requires a lot of tweaks. It lloks it is tending to lock but requires very long stime so I tried 6000 samples.
clear all; close all; clc;
N = 6000;
h = fir1(100,0.3);
rf_signal = cos(2*pi*(0:N-1)*0.1); %.1,.11,.09
bb_sig = zeros(1, N);
y_f = zeros(1, N);
error_sig = zeros(1, N);
error_f = zeros(1, N);
%PLL
fs = 1;
f = .1;
phi_inc = f/fs;
for i = 1:N
%Downconverting to Baseband
bb_sig(i) = rf_signal(i)*exp(j*2*pi*i*phi_inc);
%Filtering
y_f = filter(h,1,bb_sig(1:i));
%Error
error(i) = real(y_f(i))*imag(y_f(i))/2^16;
phi_inc = phi_inc - error(i);
temp(i) = phi_inc;
end
plot(temp,'.-');
figure; plot(error);
figure; plot(real(y_f(end-1000:end)),'.-');