cas_circuit = rfckt.cascade('Ckts',{rfckt.seriesrlc('R',1), rfckt.shuntrlc('R',1)});
freq = [0:0.01e9:10e9];
analyze(cas_circuit, freq)
cas_circuit.AnalyzedResult
sp = sparameters(cas_circuit.AnalyzedResult)
rfplot(sp,'abs')
z0 = cas_circuit.AnalyzedResult.Z0; zS = cas_circuit.AnalyzedResult.ZS; zL = cas_circuit.AnalyzedResult.ZL;
z0 = real(z0); zS = real(zS); zL = real(zL);
difftf = s2tf(sp);
[rationalfunc, errdb] = rationalfit(freq,difftf)
npoles = length(rationalfunc.A);
fprintf('The derived rational function contains %d poles.\n',npoles);
freqsforresp = linspace(0,10e9,1001)';
resp = freqresp(rationalfunc,freqsforresp);
figure
subplot(2,1,1)
plot(freq*1.e-9,(abs(difftf)),'r',freqsforresp*1.e-9, ...
(abs(resp)),'b--','LineWidth',2)
title(sprintf('Rational Fitting with %d poles',npoles),'FontSize',12)
ylabel('Magnitude (decibels)')
xlabel('Frequency (GHz)')
legend('Original data','Fitting result')
subplot(2,1,2)
origangle = unwrap(angle(difftf))*180/pi+360*freq'*rationalfunc.Delay;
plotangle = unwrap(angle(resp))*180/pi+360*freqsforresp*rationalfunc.Delay;
plot(freq*1.e-9,origangle,'r',freqsforresp*1.e-9,plotangle,'b--', ...
'LineWidth',2)
ylabel('Detrended phase (deg.)')
xlabel('Frequency (GHz)')
legend('Original data','Fitting result')
ak = [0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
Dk = [1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1];
numofSR = length(Dk);
out = [];
for k = 1:1000
out = [out,Dk(numofSR)];
newbit = mod(sum(ak.*Dk),2);
Dk(numofSR) = []; Dk = [newbit, Dk];
end
datarate = 1*1e9;
samplespersymb = 100;
pulsewidth = 1/datarate;
ts = pulsewidth/samplespersymb;
numsamples = 5000;
numplotpoints = 100000;
t_in = double((1:numsamples)')*ts;
input_signal = out;
input_signal = repmat(input_signal,[samplespersymb, 1]);
input_signal = input_signal(:);
[output_signal,t_out] = timeresp(rationalfunc,input_signal,ts);
if ~isempty(which('commscope.eyediagram'))
if exist('eyedi','var')
close(eyedi)
end
eyedi = commscope.eyediagram('SamplingFrequency',1./ts, ...
'SamplesPerSymbol',samplespersymb,'OperationMode','Real Signal');
estdelay = floor(rationalfunc.Delay/ts);
update(eyedi,output_signal(estdelay+1:end));
end
max(output_signal)
overSampleRate = round((1/ts)/datarate
1 Comment
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/310100-simple-voltage-divider-using-rftoolbox#comment_403115
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/310100-simple-voltage-divider-using-rftoolbox#comment_403115
Sign in to comment.