parent
6e386a2743
commit
728532bd61
|
@ -33,10 +33,12 @@
|
|||
//-FHDR--------------------------------------------------------------------------------------------------------
|
||||
module IIR_Filter_p1 #(
|
||||
parameter coef_width = 32
|
||||
,parameter a_width = 18
|
||||
,parameter b_width = 18
|
||||
,parameter data_in_width = 16
|
||||
,parameter cascade_in_width = 37
|
||||
,parameter temp_var_width = cascade_in_width - 1
|
||||
,parameter data_out_width = cascade_in_width - 2
|
||||
,parameter cascade_in_width = 16
|
||||
,parameter data_out_width = 16
|
||||
,parameter temp_var_width = data_out_width + 1
|
||||
)
|
||||
//H(z) = a / (1 - b*z^-1)
|
||||
(
|
||||
|
@ -72,8 +74,8 @@ wire signed [data_out_width-1:0] y_im_trunc;
|
|||
mult_x
|
||||
#(
|
||||
.A_width (data_in_width )
|
||||
,.C_width (coef_width )
|
||||
,.D_width (coef_width )
|
||||
,.C_width (a_width )
|
||||
,.D_width (a_width )
|
||||
,.o_width (temp_var_width )
|
||||
)
|
||||
inst_c1 (
|
||||
|
@ -81,8 +83,8 @@ inst_c1 (
|
|||
.rstn (rstn ),
|
||||
.en (en ),
|
||||
.a (din_re ),
|
||||
.c (a_re ),
|
||||
.d (a_im ),
|
||||
.c (a_re[coef_width-1 : coef_width-a_width]),
|
||||
.d (a_im[coef_width-1 : coef_width-a_width]),
|
||||
.Re (x1_re ),
|
||||
.Im (x1_im )
|
||||
);
|
||||
|
@ -94,8 +96,8 @@ mult_C
|
|||
#(
|
||||
.A_width (cascade_in_width )
|
||||
,.B_width (cascade_in_width )
|
||||
,.C_width (coef_width )
|
||||
,.D_width (coef_width )
|
||||
,.C_width (b_width )
|
||||
,.D_width (b_width )
|
||||
,.o_width (temp_var_width )
|
||||
)
|
||||
inst_c3 (
|
||||
|
@ -104,8 +106,8 @@ inst_c3 (
|
|||
.en (en ),
|
||||
.a (dout_r1_re ),
|
||||
.b (dout_r1_im ),
|
||||
.c (b_re ),
|
||||
.d (b_im ),
|
||||
.c (b_re[coef_width-1 : coef_width-b_width]),
|
||||
.d (b_im[coef_width-1 : coef_width-b_width]),
|
||||
.Re (y1_re ),
|
||||
.Im (y1_im )
|
||||
);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
module IIR_Filter_p8 #(
|
||||
parameter coef_width = 32
|
||||
parameter coef_width = 32
|
||||
,parameter b_pow8_width = 29
|
||||
,parameter ab_pow_width = 32
|
||||
,parameter data_in_width = 16
|
||||
,parameter data_out_width = 37
|
||||
,parameter temp_var_width = data_out_width+5
|
||||
,parameter data_out_width = 16
|
||||
,parameter temp_var_width = 29
|
||||
)
|
||||
// H(z) = a(1 + b*z^-1 + b^2*z^-2 + b^3*z^-3 + b^4*z^-4 + b^5*z^-5 + b^6*z^-6 + b^7*z^-7) / (1 - b^8*z^-8)
|
||||
(
|
||||
|
@ -51,25 +53,25 @@ assign dinp[2] = dinp2;
|
|||
assign dinp[1] = dinp1;
|
||||
assign dinp[0] = dinp0;
|
||||
|
||||
wire signed [coef_width-1 :0] ab_pow_re [7:0];
|
||||
assign ab_pow_re[7] = ab_pow7_re;
|
||||
assign ab_pow_re[6] = ab_pow6_re;
|
||||
assign ab_pow_re[5] = ab_pow5_re;
|
||||
assign ab_pow_re[4] = ab_pow4_re;
|
||||
assign ab_pow_re[3] = ab_pow3_re;
|
||||
assign ab_pow_re[2] = abb_re;
|
||||
assign ab_pow_re[1] = ab_re;
|
||||
assign ab_pow_re[0] = a_re;
|
||||
wire signed [ab_pow_width-1 :0] ab_pow_re [7:0];
|
||||
assign ab_pow_re[7] = ab_pow7_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[6] = ab_pow6_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[5] = ab_pow5_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[4] = ab_pow4_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[3] = ab_pow3_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[2] = abb_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[1] = ab_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_re[0] = a_re[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_re[coef_width-ab_pow_width-1];
|
||||
|
||||
wire signed [coef_width-1 :0] ab_pow_im [7:0];
|
||||
assign ab_pow_im[7] = ab_pow7_im;
|
||||
assign ab_pow_im[6] = ab_pow6_im;
|
||||
assign ab_pow_im[5] = ab_pow5_im;
|
||||
assign ab_pow_im[4] = ab_pow4_im;
|
||||
assign ab_pow_im[3] = ab_pow3_im;
|
||||
assign ab_pow_im[2] = abb_im;
|
||||
assign ab_pow_im[1] = ab_im;
|
||||
assign ab_pow_im[0] = a_im;
|
||||
wire signed [ab_pow_width-1 :0] ab_pow_im [7:0];
|
||||
assign ab_pow_im[7] = ab_pow7_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[6] = ab_pow6_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[5] = ab_pow5_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[4] = ab_pow4_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[3] = ab_pow3_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[2] = abb_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[1] = ab_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
assign ab_pow_im[0] = a_im[coef_width-1 : coef_width-ab_pow_width];//+ab_pow7_im[coef_width-ab_pow_width-1];
|
||||
|
||||
|
||||
wire signed [temp_var_width-1 :0] x_re [0:7];
|
||||
|
@ -82,8 +84,8 @@ reg signed [temp_var_width+3 :0] v1_im;
|
|||
|
||||
wire signed [temp_var_width+3 :0] y_re;
|
||||
wire signed [temp_var_width+3 :0] y_im;
|
||||
reg signed [temp_var_width+3 :0] y1_re;
|
||||
reg signed [temp_var_width+3 :0] y1_im;
|
||||
wire signed [temp_var_width+3 :0] y1_re;
|
||||
wire signed [temp_var_width+3 :0] y1_im;
|
||||
|
||||
wire signed [data_out_width-1:0] y_re_trunc;
|
||||
wire signed [data_out_width-1:0] y_im_trunc;
|
||||
|
@ -101,8 +103,8 @@ generate
|
|||
for (i = 0; i < 8; i = i + 1) begin: mult_c_inst
|
||||
mult_x #(
|
||||
.A_width (data_in_width ),
|
||||
.C_width (coef_width ),
|
||||
.D_width (coef_width ),
|
||||
.C_width (ab_pow_width ),
|
||||
.D_width (ab_pow_width ),
|
||||
.o_width (temp_var_width )
|
||||
) inst_c (
|
||||
.clk (clk ),
|
||||
|
@ -146,8 +148,8 @@ mult_C
|
|||
#(
|
||||
.A_width (temp_var_width+4 )
|
||||
,.B_width (temp_var_width+4 )
|
||||
,.C_width (coef_width )
|
||||
,.D_width (coef_width )
|
||||
,.C_width (b_pow8_width )
|
||||
,.D_width (b_pow8_width )
|
||||
,.o_width (temp_var_width+4 )
|
||||
)
|
||||
inst_c9 (
|
||||
|
@ -156,8 +158,8 @@ inst_c9 (
|
|||
.en (en ),
|
||||
.a (y_re ),
|
||||
.b (y_im ),
|
||||
.c (b_pow8_re ),
|
||||
.d (b_pow8_im ),
|
||||
.c (b_pow8_re[coef_width-1 : coef_width-b_pow8_width]),//+b_pow8_re[coef_width-b_pow8_width-1]),
|
||||
.d (b_pow8_im[coef_width-1 : coef_width-b_pow8_width]),//+b_pow8_im[coef_width-b_pow8_width-1]),
|
||||
.Re (y1_re ),
|
||||
.Im (y1_im )
|
||||
);
|
||||
|
|
|
@ -1,7 +1,39 @@
|
|||
|
||||
module IIR_top #(
|
||||
parameter data_out_width = 23
|
||||
,parameter temp_var_width = data_out_width + 14
|
||||
parameter data_out_width = 18
|
||||
,parameter coef_width = 32
|
||||
,parameter a0_width = 32
|
||||
,parameter b0_width = 29
|
||||
,parameter b0_i_width = 29
|
||||
,parameter b0_o_width = 19
|
||||
,parameter a1_width = 19
|
||||
,parameter b1_width = 19
|
||||
,parameter b1_i_width = 19
|
||||
,parameter b1_o_width = 19
|
||||
,parameter a2_width = 21
|
||||
,parameter b2_width = 21
|
||||
,parameter b2_i_width = 19
|
||||
,parameter b2_o_width = 19
|
||||
,parameter a3_width = 21
|
||||
,parameter b3_width = 21
|
||||
,parameter b3_i_width = 19
|
||||
,parameter b3_o_width = 19
|
||||
,parameter a4_width = 20
|
||||
,parameter b4_width = 20
|
||||
,parameter b4_i_width = 19
|
||||
,parameter b4_o_width = 18
|
||||
,parameter a5_width = 21
|
||||
,parameter b5_width = 21
|
||||
,parameter b5_i_width = 18
|
||||
,parameter b5_o_width = 18
|
||||
,parameter a6_width = 21
|
||||
,parameter b6_width = 21
|
||||
,parameter b6_i_width = 18
|
||||
,parameter b6_o_width = 18
|
||||
,parameter a7_width = 22
|
||||
,parameter b7_width = 22
|
||||
,parameter b7_i_width = 18
|
||||
,parameter b7_o_width = 18
|
||||
)
|
||||
(
|
||||
input rstn
|
||||
|
@ -53,27 +85,31 @@ module IIR_top #(
|
|||
,output signed [data_out_width-1 :0] IIRout_p7 // y(8n-113)
|
||||
);
|
||||
|
||||
wire signed [temp_var_width- 1:0] IIRout_p0_re;
|
||||
wire signed [temp_var_width- 3:0] IIRout_p1_re;
|
||||
wire signed [temp_var_width- 5:0] IIRout_p2_re;
|
||||
wire signed [temp_var_width- 7:0] IIRout_p3_re;
|
||||
wire signed [temp_var_width- 9:0] IIRout_p4_re;
|
||||
wire signed [temp_var_width-11:0] IIRout_p5_re;
|
||||
wire signed [temp_var_width-13:0] IIRout_p6_re;
|
||||
wire signed [temp_var_width-15:0] IIRout_p7_re;
|
||||
wire signed [temp_var_width- 1:0] IIRout_p0_im;
|
||||
wire signed [temp_var_width- 3:0] IIRout_p1_im;
|
||||
wire signed [temp_var_width- 5:0] IIRout_p2_im;
|
||||
wire signed [temp_var_width- 7:0] IIRout_p3_im;
|
||||
wire signed [temp_var_width- 9:0] IIRout_p4_im;
|
||||
wire signed [temp_var_width-11:0] IIRout_p5_im;
|
||||
wire signed [temp_var_width-13:0] IIRout_p6_im;
|
||||
wire signed [temp_var_width-15:0] IIRout_p7_im;
|
||||
wire signed [b0_o_width- 1:0] IIRout_p0_re;
|
||||
wire signed [b1_o_width- 1:0] IIRout_p1_re;
|
||||
wire signed [b2_o_width- 1:0] IIRout_p2_re;
|
||||
wire signed [b3_o_width- 1:0] IIRout_p3_re;
|
||||
wire signed [b4_o_width- 1:0] IIRout_p4_re;
|
||||
wire signed [b5_o_width- 1:0] IIRout_p5_re;
|
||||
wire signed [b6_o_width- 1:0] IIRout_p6_re;
|
||||
wire signed [b7_o_width- 1:0] IIRout_p7_re;
|
||||
wire signed [b0_o_width- 1:0] IIRout_p0_im;
|
||||
wire signed [b1_o_width- 1:0] IIRout_p1_im;
|
||||
wire signed [b2_o_width- 1:0] IIRout_p2_im;
|
||||
wire signed [b3_o_width- 1:0] IIRout_p3_im;
|
||||
wire signed [b4_o_width- 1:0] IIRout_p4_im;
|
||||
wire signed [b5_o_width- 1:0] IIRout_p5_im;
|
||||
wire signed [b6_o_width- 1:0] IIRout_p6_im;
|
||||
wire signed [b7_o_width- 1:0] IIRout_p7_im;
|
||||
|
||||
|
||||
|
||||
IIR_Filter_p8 #(
|
||||
.data_out_width (temp_var_width )
|
||||
.coef_width (coef_width ),
|
||||
.b_pow8_width (b0_width ),
|
||||
.ab_pow_width (a0_width ),
|
||||
.temp_var_width (b0_i_width ),
|
||||
.data_out_width (b0_o_width )
|
||||
) inst_iir_p0 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -109,7 +145,11 @@ IIR_Filter_p8 #(
|
|||
);
|
||||
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a1_width ),
|
||||
.b_width (b1_width ),
|
||||
.cascade_in_width (b1_i_width ),
|
||||
.data_out_width (b1_o_width )
|
||||
) inst_iir_p1(
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -125,7 +165,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p1_im ) // Im(y(8n-23))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-2 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a2_width ),
|
||||
.b_width (b2_width ),
|
||||
.cascade_in_width (b2_i_width ),
|
||||
.data_out_width (b2_o_width )
|
||||
) inst_iir_p2 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -141,7 +185,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p2_im ) // Im(y(8n-38))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-4 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a3_width ),
|
||||
.b_width (b3_width ),
|
||||
.cascade_in_width (b3_i_width ),
|
||||
.data_out_width (b3_o_width )
|
||||
) inst_iir_p3 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -157,7 +205,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p3_im ) // Im(y(8n-53))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-6 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a4_width ),
|
||||
.b_width (b4_width ),
|
||||
.cascade_in_width (b4_i_width ),
|
||||
.data_out_width (b4_o_width )
|
||||
) inst_iir_p4 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -173,7 +225,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p4_im ) // Im(y(8n-68))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-8 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a5_width ),
|
||||
.b_width (b5_width ),
|
||||
.cascade_in_width (b5_i_width ),
|
||||
.data_out_width (b5_o_width )
|
||||
) inst_iir_p5 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -189,7 +245,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p5_im ) // Im(y(8n-83))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-10 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a6_width ),
|
||||
.b_width (b6_width ),
|
||||
.cascade_in_width (b6_i_width ),
|
||||
.data_out_width (b6_o_width )
|
||||
) inst_iir_p6 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -205,7 +265,11 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p6_im ) // Im(y(8n-98))
|
||||
);
|
||||
IIR_Filter_p1 #(
|
||||
.cascade_in_width (temp_var_width-12 )
|
||||
.coef_width (coef_width ),
|
||||
.a_width (a7_width ),
|
||||
.b_width (b7_width ),
|
||||
.cascade_in_width (b7_i_width ),
|
||||
.data_out_width (b7_o_width )
|
||||
) inst_iir_p7 (
|
||||
.clk (clk ),
|
||||
.rstn (rstn ),
|
||||
|
@ -221,14 +285,14 @@ IIR_Filter_p1 #(
|
|||
.dout_im (IIRout_p7_im ) // Im(y(8n-113))
|
||||
);
|
||||
|
||||
assign IIRout_p0 = IIRout_p0_re[temp_var_width- 0-1 : temp_var_width- 0-data_out_width]; // y(8n-8)
|
||||
assign IIRout_p1 = IIRout_p1_re[temp_var_width- 2-1 : temp_var_width- 2-data_out_width]; // y(8n-23)
|
||||
assign IIRout_p2 = IIRout_p2_re[temp_var_width- 4-1 : temp_var_width- 4-data_out_width]; // y(8n-38)
|
||||
assign IIRout_p3 = IIRout_p3_re[temp_var_width- 6-1 : temp_var_width- 6-data_out_width]; // y(8n-53)
|
||||
assign IIRout_p4 = IIRout_p4_re[temp_var_width- 8-1 : temp_var_width- 8-data_out_width]; // y(8n-68)
|
||||
assign IIRout_p5 = IIRout_p5_re[temp_var_width-10-1 : temp_var_width-10-data_out_width]; // y(8n-83)
|
||||
assign IIRout_p6 = IIRout_p6_re[temp_var_width-12-1 : temp_var_width-12-data_out_width]; // y(8n-98)
|
||||
assign IIRout_p7 = IIRout_p7_re[temp_var_width-14-1 : temp_var_width-14-data_out_width]; // y(8n-113)
|
||||
assign IIRout_p0 = IIRout_p0_re[b0_o_width-1 : b0_o_width-data_out_width]; // y(8n-8)
|
||||
assign IIRout_p1 = IIRout_p1_re[b1_o_width-1 : b1_o_width-data_out_width]; // y(8n-23)
|
||||
assign IIRout_p2 = IIRout_p2_re[b2_o_width-1 : b2_o_width-data_out_width]; // y(8n-38)
|
||||
assign IIRout_p3 = IIRout_p3_re[b3_o_width-1 : b3_o_width-data_out_width]; // y(8n-53)
|
||||
assign IIRout_p4 = IIRout_p4_re[b4_o_width-1 : b4_o_width-data_out_width]; // y(8n-68)
|
||||
assign IIRout_p5 = IIRout_p5_re[b5_o_width-1 : b5_o_width-data_out_width]; // y(8n-83)
|
||||
assign IIRout_p6 = IIRout_p6_re[b6_o_width-1 : b6_o_width-data_out_width]; // y(8n-98)
|
||||
assign IIRout_p7 = IIRout_p7_re[b7_o_width-1 : b7_o_width-data_out_width]; // y(8n-113)
|
||||
|
||||
endmodule
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
module TailCorr_top #(
|
||||
parameter temp_var_width = 22
|
||||
parameter temp_var_width = 18
|
||||
)
|
||||
(
|
||||
input rstn
|
||||
|
|
|
@ -3,7 +3,7 @@ module trunc #(
|
|||
//,parameter integer dow = msb - (lsb -1)
|
||||
,parameter integer msb = 7
|
||||
,parameter integer lsb = 1
|
||||
,parameter integer half_precision = 0
|
||||
,parameter integer half_precision = 1
|
||||
)
|
||||
(
|
||||
input clk
|
||||
|
|
|
@ -5,8 +5,11 @@ data_source = 'matlab';
|
|||
file_path = "/home/thfu/work/TailCorr/sim/";
|
||||
rng('shuffle');
|
||||
|
||||
max_error = zeros(100,1);
|
||||
|
||||
for time = 1:100
|
||||
if strcmp(data_source, 'matlab')
|
||||
in = floor(cat(1,0,30000*ones(4*2579+4,1)));
|
||||
in = floor(cat(1,0,30000*rand(4*2579+4,1)));
|
||||
for i = 0:3
|
||||
filename = strcat(file_path, "in", num2str(i), "_matlab.dat");
|
||||
subset = in(i+1:4:end);
|
||||
|
@ -64,17 +67,19 @@ wave_float_8 = interp1(1:wave_float_len,wave_float,1:1/8:(wave_float_len+1-1/8),
|
|||
[cs_wave_A,wave_float_A,Delay] = alignsignals(cs_wave,wave_float,Method="xcorr");
|
||||
N = min(length(wave_float),length(cs_wave_A));
|
||||
figure()
|
||||
diff_plot(wave_float_A, cs_wave_A,'float','verdi',[0 N]);
|
||||
max_error(time) = diff_plot(wave_float_A, cs_wave_A,'float','verdi',[0 N]);
|
||||
|
||||
%% Test of iir filter with no intp
|
||||
end
|
||||
|
||||
[wave_float_A,wave_verdi_A,Delay] = alignsignals(wave_float,wave_verdi);
|
||||
N = min(length(wave_float_A),length(wave_verdi_A));
|
||||
figure()
|
||||
diff_plot(wave_float_A, wave_verdi_A,'float','verdi',[0 N]);
|
||||
%%
|
||||
signalAnalyzer(wave_float,wave_verdi,'SampleRate',1);
|
||||
%%
|
||||
% %% Test of iir filter with no intp
|
||||
%
|
||||
% [wave_float_A,wave_verdi_A,Delay] = alignsignals(wave_float,wave_verdi);
|
||||
% N = min(length(wave_float_A),length(wave_verdi_A));
|
||||
% figure()
|
||||
% diff_plot(wave_float_A, wave_verdi_A,'float','verdi',[0 N]);
|
||||
% %%
|
||||
% signalAnalyzer(wave_float,wave_verdi,'SampleRate',1);
|
||||
% %%
|
||||
|
||||
a_fix = round(a*2^31);
|
||||
b_fix = round(b*2^31);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function diff_plot(iir_out, Script_out,leg1,leg2,a)
|
||||
function result = diff_plot(iir_out, Script_out,leg1,leg2,a)
|
||||
|
||||
N = min(length(iir_out),length(Script_out));
|
||||
iir_out = iir_out(1:N);
|
||||
|
@ -32,3 +32,5 @@ plot(n(R_mpos_min),diff(R_mpos_min),'r*')
|
|||
|
||||
text(n(R_mpos_max), diff(R_mpos_max), ['(',num2str(n(R_mpos_max)),',',num2str(diff(R_mpos_max)),')'],'color','k');
|
||||
text(n(R_mpos_min), diff(R_mpos_min), ['(',num2str(n(R_mpos_min)),',',num2str(diff(R_mpos_min)),')'],'color','k');
|
||||
|
||||
result = max(abs(diff(R_mpos_max)),abs(diff(R_mpos_min)));
|
||||
|
|
Loading…
Reference in New Issue