Contents
clc
close all
clear all
set(0, 'DefaultLineLineWidth', 2);
load Data_8k.mat
FT = @(x) db(abs((fft(x))));
lambda = 0.4;
Ts = 1e-5;
t = 0:Ts:(numel(x)-1)*Ts;
c1 = [1 1 1] .* 0.7;
rec = US_Rec(y, x, lambda, 4);
Plot original signal vs. modulo samples
figure(1);
subplot(3,1,1);
hold on;
plot(t, x, 'Color', c1);
stem(t, y, 'r', Marker='none', LineWidth=2);
axis tight;
legend('Conventional ADC', 'MADC', 'Location', 'northeast', 'Orientation', 'horizontal', 'Box', 'Off');
ylim([-2 3]);
title('(a) Sinusoidal Mixture: Weak (0.3V, 1 kHz) and Strong (2V, 8 kHz).');
ylabel('Amplitude (V)');
xlabel('Time (sec)');
subplot(3,1,2);
hold on;
plot(t, x, 'Color', c1);
plot(t, rec - mean(rec) + mean(x), 'r-.', 'LineWidth', 2);
axis tight;
legend('Conventional ADC', 'US-Alg', 'Location', 'northeast', 'Orientation', 'horizontal', 'Box', 'Off');
ylim([-2 3]);
str = sprintf(['(b) Reconstruction from Modulo Samples using US-Alg. (MSE = %0.1e)'], immse(x, rec));
title(str);
ylabel('Amplitude (V)');
xlabel('Time (sec)');
subplot(3,1,3);
N = numel(x);
f = ([0:N-1]) / N / Ts;
hold on;
plot(f, FT(x), 'Color', c1);
plot(f, FT(rec), 'r');
axis tight;
legend('Conventional ADC', 'US-Alg', 'Box', 'off');
xlim([0 30] .* 1e3);
title('(c) Fourier Spectrum: Improved Noise Floor.');
ylabel('Amplitude (dB)');
xlabel('Frequency (Hz)');
xticks(union(0:10:30, [1 8]) .* 1e3);
grid on;
ax = gca;
ax.XAxis.Exponent = 3;