diff --git a/applications/apertif/matlab/run_pfft.m b/applications/apertif/matlab/run_pfft.m index 08c16006c51c3a0d2edcd16d4eed957795766b29..68d9988468b488accbff3fb162f16b0c7572f4dc 100644 --- a/applications/apertif/matlab/run_pfft.m +++ b/applications/apertif/matlab/run_pfft.m @@ -44,10 +44,13 @@ tb.model_signal = 'sinusoid'; % Use sinusoid to check the frequency res tb.model_quantization = 'floating point'; tb.model_quantization = 'fixed point'; -tb.nof_subbands = 64; +tb.nof_subbands = 16; % Carrier frequency -tb.subband_wg = 43; % subband range 0:tb.nof_subbands-1, can be fraction to have any sinusoid frequency +tb.subband_wg = 4; % subband range 0:tb.nof_subbands-1, can be fraction to have any sinusoid frequency +if tb.nof_subbands == 64 + tb.subband_wg = 43; % use 43 to recreate HDL reference data for nof_subbands = 64, else use 1 to fit any nof_subbands +end %tb.subband_wg = 1.55; %tb.subband_wg = 12; @@ -56,13 +59,13 @@ tb.sop = 1; % initial 'impulse' start index in range ctr % Model a frequency sweep of the 'sinusoid' tb.chirp = 0; % 0 = use fixed tb.subband_wg frequency or pulse period equal to block_size -tb.chirp = 1; % else increment WG frequency every block to have chirp frequency sweep or slide the pulse +%tb.chirp = 1; % else increment WG frequency every block to have chirp frequency sweep or slide the pulse if strcmp(tb.model_signal, 'noise') tb.nof_tsub = 10 ; % number of subband periods to simulate elseif tb.chirp tb.nof_tsub = 200; % number of subband periods to simulate else - tb.nof_tsub = 1; % number of subband periods to simulate + tb.nof_tsub = 5; % number of subband periods to simulate end tb.plot_per_block = 0; % 1 = plot spectrum for each block in time, else skip this plot to save time @@ -205,8 +208,8 @@ if strcmp(tb.model_quantization, 'fixed point') fid = fopen(file_name, 'w'); fprintf(fid,'Nof lines WG output: %d\n', length(wg_q_data(:))); fprintf(fid,'Nof lines PFFT output: %d\n', length(pfft_subband_q_data(:))); - for bI = tbegin:tend % WG output + for bI = tbegin:tend for bJ = 1:tb.subband_fft_size fprintf(fid,'%d\n', wg_q_data(bI, bJ)); end @@ -239,7 +242,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); -data = data_wg'; +data = data_wg.'; plot(ts, data(:)) ylim([-1.3 1.3]); title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg)); @@ -252,7 +255,7 @@ fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); -data = data_pfft_subband'; +data = data_pfft_subband.'; data = data(:); hy = 1.2 * max(abs(data)); plot(tsub_all, real(data), 'r', tsub_all, imag(data), 'b'); @@ -273,7 +276,7 @@ fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); subplot(2,1,1); -data = sub_ampl'; +data = sub_ampl.'; data = data(:); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg)); @@ -281,7 +284,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts ylabel('Voltage'); grid on; subplot(2,1,2); -data = sub_phase'; +data = sub_phase.'; data = data(:); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); ylim([-180 180]) diff --git a/applications/apertif/matlab/run_pfft_complex.m b/applications/apertif/matlab/run_pfft_complex.m index 85593a13a3a2d69670313390d27877976024f14c..53fac43be00e5cb29a2062aefab17ca857c8f502 100644 --- a/applications/apertif/matlab/run_pfft_complex.m +++ b/applications/apertif/matlab/run_pfft_complex.m @@ -45,7 +45,7 @@ tb.model_signal = 'phasor'; % Use phasor to check the frequency respo tb.model_quantization = 'floating point'; tb.model_quantization = 'fixed point'; -tb.nof_channels = 64; +tb.nof_channels = 32; % Carrier frequency tb.channel_wg = 1; % channel range -tb.nof_channels/2:tb.nof_channels/2-1, can be fraction to have any sinusoid frequency diff --git a/applications/apertif/matlab/run_pfir.m b/applications/apertif/matlab/run_pfir.m index f26287a9fe301e2163a74f9d19b962231c7afb01..2d004d2df6d75e6f43546d9f2f0c75747befa19b 100644 --- a/applications/apertif/matlab/run_pfir.m +++ b/applications/apertif/matlab/run_pfir.m @@ -308,7 +308,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); -data = data_wg'; +data = data_wg.'; plot(ts, data(:)) ylim([-1.3 1.3]); title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg)); @@ -359,7 +359,7 @@ ylabel('Magnitude [dB]'); fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); -data = data_pfir_subband'; +data = data_pfir_subband.'; plot(ts, data(:)) title(sprintf('Subband PFIR filter output - FFT input data (WG subband %6.3f)', tb.subband_wg)); ylim([-2 2]); % Delay tracking step when tb.subband_wg is .5 causes double range @@ -378,7 +378,7 @@ fig=fig+1; figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure(fig); subplot(2,1,1); -data = sub_ampl'; +data = sub_ampl.'; data = data(:); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg)); @@ -386,7 +386,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts ylabel('Voltage'); grid on; subplot(2,1,2); -data = sub_phase'; +data = sub_phase.'; data = data(:); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); ylim([-180 180])