# How to reconstruct an image from s-parameters in Matlab?

I have a set of data which is the s-parameter (s11), consisting of 2 columns ($1001 \times 2$). The first column represents the frequency and the second column is the magnitude in dB. I need to use these data to reconstruct an image using Matlab but I have no idea how to do it.

I know that I have to use ifft function first to transform from frequency domain to time domain but the result I had consists of real and imaginary part and I do not know how to deal with this.

• What do s-parameter (s11) mean? – Laurent Duval Mar 16 '18 at 22:19

Each complex value can be described as $$A \cdot e^{i\cdot \phi}$$. Where A is the magnitude and $\phi$ the angle. With this knowlege you can use the ifft as you allready mentioned. If you consider that the image is a real signal you can take the real part by using real().

So overall it the part after reading the magnitude and angle would look like

IMG = uint8(real(ifft2(mag .* exp(i * angle))));


Where IMG is the resulting image, mag the array of magnitudes (in linear scaling), angle the array of angles.

The only problem with that is, that you have to know the dimensions of the image. The spectrum of an image has (after FFT) the same dimensions as the picture (113 x 200 pixel picture -> 113 x 200 matrix after FFT). So your mag and angle must have the dimension of the resulting picture (e.g. 113 x 200).

As posed, a potential response seems very involved to me. Here are steps, some of them requiring more details from you.

• What do s-parameter (s11) mean? This could help decipher the question. Such names are common with antennas, but I don't see the relation here.
• Is your data made of genuine frequencies? Can you verify that the frequencies can be interpreted as a 2D spectrum, are they integer, relative, etc.? If they are linear, some information should be inferred.
• Is your data made of genuine magnitudes? Do they exhibit symmetries (and the image could then be real), or do you have only about the half of them?
• Easy task: convert dBs to true amplitudes
• What is the size of the image? If you have a full set of coefficients, including symmetries, then $1001 = 7\times 11\times 13$ provides some hints on the number of rows/columns: $7\times 143$ or $11\times 91$ or or $13\times 77$. Those are very unusual sizes. Below are depicted an image and two standard depictions for the 2D spectrum for a $77\times 13$ images. Looking at them carefully, one might better understand the symmetries, the special values, etc. For instance, the maximum value, non-repeated, is quite often the mean of the image (on the center of the most-right picture).

• Now if you have managed to arrive here, the most interesting image processing part comes into play: how can one recover a real image from the magnitude spectrum only? This is an active body of research, look at phase retrieval, or get some background at:

I may be wrong, but in the present from, the exercice is very hard if not impossible.