%This code is made to demonstrate how to run denoising algorithm. For details of the algorithm's work, see 
%[Shumakov, Beaverstone and Nikolova "De-noising algorithm for enhancing microwave imaging", IET JoE, 2017]

%CODE REQUIREMENTS:

%1. The S-parameter raw data are assumed to be in the (x,y,freq,z) format.

%%
clear;clc

%load transmission coefficient from port 2 to port 3 - reference object
%(RO) acquisition
load 'S32_RO';
[S32_RO_signal,S32_RO_noise]=denoising(S32_RO,1); %enable de-noising algorithm

figure 
imagesc(0:20,0:20,abs(S32_RO(:,:,16))); %imaged area is 20 by 20 cm; frequency is 12.5 GHz 
title ('Measured 12.5 GHz transmission coefficient modulus of RO')
colorbar;

figure
imagesc(0:20,0:20,abs(S32_RO_signal(:,:,16))); %signal component
title ('Extracted signal-component modulus for RO')
colorbar;

figure
imagesc(0:20,0:20,abs(S32_RO_noise(:,:,16))); %noise component
title ('Extracted noise-component modulus for RO')
colorbar;