2024-10-17 17:29:11 +08:00
|
|
|
%%%verification of polyphase structures using trig
|
2024-10-08 11:23:42 +08:00
|
|
|
clc;clear all;close all
|
|
|
|
|
|
|
|
fs = 1e8;
|
|
|
|
t = (0:1:1e2)'/fs;
|
|
|
|
% f = 20e6;
|
|
|
|
% s = sin(2*pi*f*t);
|
|
|
|
s = triang(1e2-1);
|
|
|
|
s = [zeros(1,10) s' zeros(1,10)]';
|
|
|
|
N = length(s);
|
|
|
|
ts = (0:1:N-1)'/fs;
|
|
|
|
%%%
|
|
|
|
s_r1 = [0 s(1:end-1,1)']';
|
|
|
|
[s2,s2_mean] = MeanIntp(s,s_r1);
|
|
|
|
|
|
|
|
s_intp2 = zeros(2*N,1);
|
|
|
|
s_intp2(1:2:2*N) = s2_mean;
|
|
|
|
s_intp2(2:2:2*N) = s2;
|
|
|
|
t_intp2 = (0:1:2*N-1)'/fs/2;
|
|
|
|
%%%
|
|
|
|
s2_r1 = [0 s2(1:end-1,1)']';
|
|
|
|
|
|
|
|
[s4_4,s4_3] = MeanIntp(s2,s2_mean);
|
|
|
|
[s4_2,s4_1] = MeanIntp(s2_mean,s2_r1);
|
|
|
|
|
|
|
|
s_intp4 = zeros(4*N,1);
|
|
|
|
s_intp4(1:4:4*N) = s4_1;
|
|
|
|
s_intp4(2:4:4*N) = s4_2;
|
|
|
|
s_intp4(3:4:4*N) = s4_3;
|
|
|
|
s_intp4(4:4:4*N) = s4_4;
|
|
|
|
|
|
|
|
t_intp4 = (0:1:4*N-1)'/fs/4;
|
|
|
|
|
|
|
|
|
|
|
|
figure('Units','normalized','Position',[0.000390625,0.517361111111111,0.49921875,0.422916666666667]);
|
|
|
|
plot(ts,s,t_intp2,s_intp2)
|
|
|
|
grid on
|
|
|
|
% xlim([0.58 0.62]*1e-6)
|
|
|
|
%
|
|
|
|
%
|
|
|
|
figure('Units','normalized','Position',[0.500390625,0.517361111111111,0.49921875,0.422916666666667]);
|
|
|
|
plot(t_intp4,s_intp4)
|
|
|
|
grid on
|
|
|
|
% xlim([0.58 0.62]*1e-6)
|
|
|
|
|