MATLAB Answers

how to export the impedance matrix from Feko into Matlab

65 views (last 30 days)
Ano
Ano on 7 Nov 2016
Commented: Ano on 24 Nov 2020 at 19:18
Hello, I would like to export the impedance matrix from FEKO into matlab but Matlab says that the .mat file is corrupted, any help in this issue?! Thank you in advance

  5 Comments

Show 2 older comments
sumithra Panneer Selvam
sumithra Panneer Selvam on 24 Feb 2018
Dear experts, I need to plot eigen value graph for characteristic modes with eigen value (339X1) and frequency (22X1) in the range of 1.35ghz to 1.5ghz. I have attached .mat file of eigen value(num.mat) and frequency(frequency.mat). Plz help.
Ano
Ano on 24 Feb 2018
Hello! in order to be able to plot that graph the eigenvalues matrix should be of size (339x22) which means that you get the eigenvalues for each frequency sample.

Sign in to comment.

Accepted Answer

Klearchos Samaras
Klearchos Samaras on 14 Mar 2017
Edited: Klearchos Samaras on 15 Mar 2017
First of all, this *.mat file is not a typical *.mat file. It has a FORTRAN block structure. You can find some useful information here: http://www.feko.info/support/helpcenter/how-to/how-to-read-the-.mat-.lud-.rhs-files-and-.str-files .
I am a FEKO user too. Well, the mat2ascii.exe utility can be used via Command Prompt and the data can be stored in a *.txt file, however the generated file will only contain the rows, columns, real part and imaginary part of the impedance matrix FOR THE FIRST FREQUENCY OF THE SIMULATION. In other words, if you want to simulate at a frequency range (multiple frequencies) the generated *.mat file contains the data of every impedance matrix, however the mat2ascii.exe utility converts only the data of the first impedance matrix of the simulation to *.txt file. Maybe the *.mat file can be easily read in a FORTRAN environment but I don't know that. I have tried to use the f2matlab routine created by Prof. Ben Barrowes, but it failed. I am no expert in programming, though.
*IMPORTANT: There might be a mistake in the *.txt file generated by mat2ascii.exe. It contains some explanatory text in the beginning and then it contains 4 columns with the data of the first frequency impedance matrix. The first column has the numbers of rows, the second has the numbers of columns, the third has the elements of R matrix (real part) and the fourth has the numbers of X matrix (imaginary part). I believe that the third column should be labeled as imaginary and the fourth as real, because the very first element of the R matrix should always be a positive number (it belongs to the main diagonal and R is positive definite), but in my case it is negative.

  0 Comments

Sign in to comment.

More Answers (2)

Ano
Ano on 2 Nov 2018
the process of exporting the impedance matrix from Feko into Matlab will be illustrated. To begin with, the antenna design is build and meshed in CADFEKO without specifying any feeding structure. Then, under the rubric solve/run the EDITFEKO option is activated. EDITFEKO is a script file where the meshed geometry is imported, and the solution configurations are established using the control cards. The foremost cards to be edited are EG card used to set the solution accuracy to double precision, and FR card that serves for setting the simulation frequency (single frequency option is used). After that the PS card is edited, and the option allowing to save the impedance matrix elements to *.mat file is chosen. No further settings are required for FEKO files, and the project is saved. All the remaining manipulations will be managed using Matlab environment. In the other side, in order to generate an impedance matrix for each frequency step, two scripts are used where the same project name is used as in FEKO. The role of each script will be illustrated for a project name ’metalplate’. MultiFrqFeko.m : this script generates the *.pre files for each single frequency step. The content of ’metalplate.pre’ is copied into a temporary file ’metalplate.tmp’, where the line containing ’#this frq =’ , is modified to get the numerical value of the corresponding frequency step. Then, a new file is created having the name of the project followed by the number of the corresponding frequency step (i.e. metalplate1.pre). Finally, the ’dos’ function is called to perform the execution of FEKO files from Matlab.an example of the command execution can be stated as dos(’prefeko metalplate1.pre’) dos(’runfeko metalplate1.pre’) getZFeko.m : this function is used to convert the obtained impedance matrices from mat extension of FEKO into ASCII format using the mat2ascii application, and following command line system(’mat2ascii metalplate1.mat > metalplateASCII1.txt’) application can be Now the resulting impedance matrices can be easily manipulated using Matlab.

  12 Comments

Show 9 older comments
Ano
Ano on 31 May 2019
Hello!
Yes, I do remember Having this issue but I believe I solved just by checking all the concerned files. First, check the value of rowsM and start from there it wasn't that hard to solve as far as I remember.
Please post the solution so others and I included could prevent this issue if it happens.
good luck and best regards!
abdellah touhami
abdellah touhami on 24 Nov 2020 at 9:38
Dear Mr. Ano,
I want to extract the impedance matrix from feko as you explained, but unfortunately dosen't work, matlab show me an error"matlab could not open the file .mat "
if you please have you an idea.
Best regards
Ano
Ano on 24 Nov 2020 at 19:18
Hello Mr. Abdllah touhami,
If you are trying to open the matrix directly in matlab without using the scripts given in this web page or any other scipts it will not work. Note that both Matlab and Feko have the '.mat' files but it does not have the same meaning. it would be very nice if you could give more details. Good luck and best regards.

Sign in to comment.


Ano
Ano on 21 Oct 2017
Thank you very much for your answer! I just wanted to tell that the real part is ill conditioned that is why you get negative values , you might solve this just by make the negative value = 0. Best regards!

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by