Skip to content
Snippets Groups Projects
Commit f397e7fd authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Corrected title in subband phase plot. Use subplot for real() and imag() in subband plot.

parent f9276a33
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ tb.model_signal = 'phasor'; % Use phasor to check the frequency respo ...@@ -48,7 +48,7 @@ tb.model_signal = 'phasor'; % Use phasor to check the frequency respo
tb.model_quantization = 'floating point'; tb.model_quantization = 'floating point';
tb.model_quantization = 'fixed point'; tb.model_quantization = 'fixed point';
tb.nof_channels = 32; tb.nof_channels = 64;
% Carrier frequency % 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 tb.channel_wg = 1; % channel range -tb.nof_channels/2:tb.nof_channels/2-1, can be fraction to have any sinusoid frequency
...@@ -60,7 +60,7 @@ tb.sop = 1; % initial 'impulse' start index in range ctr ...@@ -60,7 +60,7 @@ tb.sop = 1; % initial 'impulse' start index in range ctr
% Model a frequency sweep of the 'sinusoid' % Model a frequency sweep of the 'sinusoid'
tb.chirp = 0; % 0 = use fixed tb.channel_wg frequency or pulse period equal to block_size tb.chirp = 0; % 0 = use fixed tb.channel_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') if strcmp(tb.model_signal, 'noise')
tb.nof_tchan = 50; % number of channel periods to simulate, >> ctrl_pfir_channel.nof_taps tb.nof_tchan = 50; % number of channel periods to simulate, >> ctrl_pfir_channel.nof_taps
elseif tb.chirp elseif tb.chirp
...@@ -394,6 +394,31 @@ xlabel(sprintf('Time 0:%d [Tchan]', tb.nof_tchan-1)); ...@@ -394,6 +394,31 @@ xlabel(sprintf('Time 0:%d [Tchan]', tb.nof_tchan-1));
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
%% Plot PFFT channels real and imaginary for all tb.nof_tchan in one plot
data = data_pfft_channel.';
data = data(:);
hy = 1.2 * max(abs(data));
fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig);
subplot(2,1,1);
plot(tchan_all, real(data), 'k', tchan_all(chan_I), real(data(chan_I)), 'ko', tchan_all(chan_Iplus1), real(data(chan_Iplus1)), 'kx');
ylim([-hy hy])
title(sprintf('Channel real data (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage');
grid on;
subplot(2,1,2);
plot(tchan_all, imag(data), 'k', tchan_all(chan_I), imag(data(chan_I)), 'ko', tchan_all(chan_Iplus1), imag(data(chan_Iplus1)), 'kx');
ylim([-hy hy])
title(sprintf('Channel imag data (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage');
grid on;
%% Plot PFFT channels spectrum and phase for all tb.nof_tchan in one plot %% Plot PFFT channels spectrum and phase for all tb.nof_tchan in one plot
chan_ampl = abs(data_pfft_channel); chan_ampl = abs(data_pfft_channel);
chan_ampl_max = max(chan_ampl(:)); chan_ampl_max = max(chan_ampl(:));
...@@ -404,6 +429,7 @@ chan_phase(x) = 0; % force phase of too small signals to 0 ...@@ -404,6 +429,7 @@ chan_phase(x) = 0; % force phase of too small signals to 0
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
subplot(2,1,1); subplot(2,1,1);
data = chan_ampl.'; data = chan_ampl.';
data = data(:); data = data(:);
...@@ -412,12 +438,13 @@ title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = % ...@@ -412,12 +438,13 @@ title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = %
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1)); xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
subplot(2,1,2); subplot(2,1,2);
data = chan_phase.'; data = chan_phase.';
data = data(:); data = data(:);
plot(tchan_all, data, 'k', tchan_all(chan_I), data(chan_I), 'ko', tchan_all(chan_Iplus1), data(chan_Iplus1), 'kx'); plot(tchan_all, data, 'k', tchan_all(chan_I), data(chan_I), 'ko', tchan_all(chan_Iplus1), data(chan_Iplus1), 'kx');
ylim([-180 180]) ylim([-180 180])
title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg)); title(sprintf('Channel data - phase (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1)); xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Phase [degrees]'); ylabel('Phase [degrees]');
grid on; grid on;
......
...@@ -257,16 +257,26 @@ ylabel('Voltage'); ...@@ -257,16 +257,26 @@ ylabel('Voltage');
grid on; grid on;
%% Plot PFFT channels real and imaginary for all tb.nof_tchan in one plot %% Plot PFFT channels real and imaginary for all tb.nof_tchan in one plot
data = data_pfft_channel.';
data = data(:);
hy = 1.2 * max(abs(data));
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
data = data_pfft_channel.'; subplot(2,1,1);
data = data(:); plot(tchan_all, real(data), 'k', tchan_all(chan_I), real(data(chan_I)), 'ko', tchan_all(chan_Iplus1), real(data(chan_Iplus1)), 'kx');
hy = 1.2 * max(abs(data));
plot(tchan_all, real(data), 'r', tchan_all, imag(data), 'b');
ylim([-hy hy]) ylim([-hy hy])
title(sprintf('Channel real and imag data (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg)); title(sprintf('Channel real data (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage');
grid on;
subplot(2,1,2);
plot(tchan_all, imag(data), 'k', tchan_all(chan_I), imag(data(chan_I)), 'ko', tchan_all(chan_Iplus1), imag(data(chan_Iplus1)), 'kx');
ylim([-hy hy])
title(sprintf('Channel imag data (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1)); xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
...@@ -281,6 +291,7 @@ chan_phase(x) = 0; % force phase of too small signals to 0 ...@@ -281,6 +291,7 @@ chan_phase(x) = 0; % force phase of too small signals to 0
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
subplot(2,1,1); subplot(2,1,1);
data = chan_ampl.'; data = chan_ampl.';
data = data(:); data = data(:);
...@@ -289,12 +300,13 @@ title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = % ...@@ -289,12 +300,13 @@ title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = %
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1)); xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
subplot(2,1,2); subplot(2,1,2);
data = chan_phase.'; data = chan_phase.';
data = data(:); data = data(:);
plot(tchan_all, data, 'k', tchan_all(chan_I), data(chan_I), 'ko', tchan_all(chan_Iplus1), data(chan_Iplus1), 'kx'); plot(tchan_all, data, 'k', tchan_all(chan_I), data(chan_I), 'ko', tchan_all(chan_Iplus1), data(chan_Iplus1), 'kx');
ylim([-180 180]) ylim([-180 180])
title(sprintf('Channel data - amplitude (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg)); title(sprintf('Channel data - phase (o,x = channel %d,%d for WG channel = %6.3f)', tb.channel_i, tb.channel_iplus1, tb.channel_wg));
xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1)); xlabel(sprintf('Channels 0:%d at time 0:%d [Tchan]', tb.nof_channels-1, tb.nof_tchan-1));
ylabel('Phase [degrees]'); ylabel('Phase [degrees]');
grid on; grid on;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment