# fresnelSynthPaper

Compares Institute Fresnel's data set with synthetic data generated by the exact contrast. This is useful to determine the error of the matched incident field and to estimate the error of the data.

Warning: This function clears variables. Also the routine `eval` is used. Be careful when using.

## Contents

- Syntax
- Description
- More About
- References
- See Also
- Code

## Syntax

Start this routine in the folder `code` by

    init;
    fresnelSynthPaper

## Description

This routine compares the Institute Fresnel's data set, see [1], with synthetic data generated by the corresponding exact contrast. It results in the error of the matched incident field, `errCmean(freq)`, and an estimate of the data error in real and imaginary part, `errRe(freq)`, `errIm(freq)`. This is done for several frequencies (1 to 8 GHz). This file was written to obtain the results for Tab. 2 in [2].

The type of data set from Institute Fresnel is chosen in paperFresnelSynth.html setting `seti.fresnelFile` to

- `'inexpdata/fresnel_opus_1/dielTM_dec8f.exp'` (single cylinder, 1--8 GHz)
- `'inexpdata/fresnel_opus_1/twodielTM_8f.exp'` (two dielectrics, 1--8 GHz)

The evaluated frequencies are set in the `for` loop with `freq` below.

The approximation order of the incident field's matchig, `nuMax`, is set to 10. A suitable approximation order can be found with `fresnelSynthNuMaxVar`. For details of `nuMax` see loadData.html.

## More About

This file is essentially a copy of the intern routine `fresnelSynth` with adaptions (fix nuMax = 10) and documentation.

The output is essentially:

    Compare yFresnel and yExactInc
    ----------
    freq | Cmean in % | errRe in % | errIm in %
    1 &  0.9 & 29.8 & 39.7
    2 &  0.6 & 18.0 & 14.9
    3 &  1.3 & 14.9 & 15.3
    4 &  0.8 & 25.2 & 19.7
    5 &  3.4 & 20.1 & 22.4
    6 &  4.2 & 39.7 & 32.7
    7 & 16.4 & 22.2 & 28.1
    8 & 18.1 & 44.3 & 39.1

## References

- [1] Kamal Belkebir and Marc Saillard. Special section on testing inversion algorithms against experimental data. Inverse Problems, 17(6):1565-1571, 2001. URL: https://doi.org/10.1088/0266-5611/17/6/301.
- [2] Florian Bürgel, Kamil S. Kazimierski, and Armin Lechleiter. A sparsity regularization and total variation based computational framework for the inverse medium problem in scattering. Journal of Computational Physics, 339:1-30, 2017. URL: https://doi.org/10.1016/j.jcp.2017.03.011.

## See Also

- loadData.html
- paperFresnelSynth.html
- fresnelSynthNuMaxVar.html

## Code

Initialization

    % close all;
    clearvars -except inseti htext; % clear all;

    warning off MATLAB:subscripting:noSubscriptsSpecified
    % off: Warning: A value of class "matlab.internal.video.PluginManager" was indexed with no subscripts specified. [...]

    disp(' ')
    disp('-----')
    disp('fresnelSynth')
    disp(' ')

    % -- initialize
    tic;
    init;

    calcyExact = 0;

    % -- set parameters

    if ~exist('inseti','var')
        %inseti = 'setiContrastFresnelSynth'; % synthetic fresnel data
        inseti = 'paperFresnelSynth'; % synthetic fresnel data
    end
    seti.inseti = inseti;
    eval(inseti)

Load Data from Institute Fresnel

    seti = checkConsisExpData(seti);

        errCmean = zeros(8,1);
        errRe = zeros(8,1);
        errIm = zeros(8,1);

    for freq = 1:8 % input: frequency in GHz

        seti.fresnelFreq = freq*1E9;

        nuMax = 10;

            seti.nuMax = nuMax;
            disp(['loading fresnel data from "' seti.fresnelFile '" for frequency = ' num2str(seti.fresnelFreq/1E9) ' GHz']) ;
            seti = loadData(seti);
            %seti = evalc('loadData(seti)'); % setGeomSim is called in loadData
            %evalc: computes but no disp output...
            %seti.errC is inside...

            yFresnel = seti.FmeasDelta;

            %disp('- yExactInc calculation using incField from Fresnel data')
            %disp('  but incField is NOT exact, so yExactInc might not be Fresnel data')
            FmeasExactInc = mimo(seti, seti.qROIexact, 'simo');
            FmeasExactInc = fresnelMiss(FmeasExactInc,yFresnel);

Compare yFresnel and yExactInc

Compare real-world data from Institute Fresnel, yFresnel, with exact computed data, yExactInc.

            disp('Compare yFresnel and yExactInc')

            errCmean(freq) = mean(seti.errC);
            errRe(freq) = norm(real(yFresnel-FmeasExactInc))/norm(real(FmeasExactInc));
            errIm(freq) = norm(imag(yFresnel-FmeasExactInc))/norm(imag(FmeasExactInc));

            %fprintf('nuMax = %g | ',nuMax);
            %fprintf('rel. err (real part) = %g | ',errRe);
            %fprintf('rel. err (imag part) = %g\n',errIm);

Notation of Values

- `Cmean`: rel. err. of (mean because min = max in our experience)
- `errRe`: rel. err of data y (real part)
- `errIm`: rel. err of data y (imag part)

    end

    disp('----------')
    disp(' freq | Cmean in % | errRe in % | errIm in %'); % with *100 below... then in percentage '%'...
    for freq = 1:8
        fprintf('%d & %4.1f & %4.1f & %4.1f\n',freq,errCmean(freq)*100, errRe(freq)*100, errIm(freq)*100);
    end
    disp('----------')