Hello I have a .s6p file, gotten from a electromagnetic simulation of a dual tapped transformer, but I want to convert this s6p file to a s2p file, with 2 differential ports and the center taps grounded. Also I have a problem with a s5p file (single-tapped transformer) and I want to convert it into a s2p file as well, with 1 differential port, 1 single ended port, and the rest of the ports grounded. Thank you
@MathiasMagdowski11 ай бұрын
That is a good question. I have no quick answer for that. You for sure need to import the s6p and s5p files into MATLAB, convert these single-mode scattering parameters into mixed-mode scattering parameters (for the common mode and differential mode, see: en.wikipedia.org/wiki/Scattering_parameters#4-port_S-parameters) and then output them back into a s2p file as needed. The input and output routine should not be a problem, but the challenging part from my point of view is the correct conversion taking into account the right characteristic reference impedance and all correct signs.
@jeffreytc11 ай бұрын
@@MathiasMagdowski Thank you so much!!!
@MathiasMagdowski11 ай бұрын
@@jeffreytc You are welcome.
@darkbf84934 ай бұрын
Amazing video. Thank you so much.
@MathiasMagdowski4 ай бұрын
@@darkbf8493 You are welcome.
@kavandave39719 ай бұрын
Hello, very informative video! I have a question regarding the .s2p file, it seems my .s2p file is little but different than shown here, I do not have s11,s12,s21,s22 labeled and also I have Port Impedance rows after every Gamma rows which I believe are s parameters. In this case, will this method work or do I need to change anything?
@kavandave39719 ай бұрын
I figured it out, I have to make some changes while exporting my .s2p file.
@MathiasMagdowski9 ай бұрын
@@kavandave3971 Excellent, great to hear that!
@MathiasMagdowski4 ай бұрын
There is another question related to this video that reached me via e-mail: "I have a question though. I successfully managed to plot the data but the y axis of my S parameters in CST Studio starts from 0 and goes up to -40. However, here in matlab, I could not convert the yaxis values to 0 to -40. Do you know how to do it?"
@MathiasMagdowski4 ай бұрын
Here is my answer to that question: Typically, plots in MATLAB have a y-axis with positive orientation. Small values are displayed at the bottom, high values are displayed at the top. Negative values are smaller than positive values and are therefore displayed at the bottom as well. If you state that your values range from 0 to -40, you correctly mean that they range from -40 to 0. At least they will be displayed that way. There are several ways to change this behavior: 1. You invert the data before plotting and use a command like plot(x,-y) which will create a plot with a y-axis ranging from 0 to 40 in your case. 2. You plot the original data and after the plot call, you add this line: set(gca, 'YDir','reverse') This will reverse the orientation of the y-axis. See the documentation for axes properties for details: de.mathworks.com/help/matlab/ref/axes-properties.html
@darkbf84934 ай бұрын
@@MathiasMagdowski Thank you so much. I actually fıgured it out later. Basically convert from magnitude to dB units. S11_dB = 20 * log10(abs(mag)). This is the code that worked out for me.
@MathiasMagdowski4 ай бұрын
@@darkbf8493 Excellent, I also recommend the nice brochure "dB or not dB? Everything you ever wanted to know about decibels but were afraid to ask…", see e.g.: www.ab4oj.com/test/docs/rs_db.pdf
@stephmo3712 жыл бұрын
what if our s2p file has the Re and Img columns for the s parameters? is there a way to change that so that i can plot the radiation pattern from that s2p file?
@MathiasMagdowski2 жыл бұрын
A Touchstone file or s2p file will usually have two columns per scattering parameter for the two components of such a complex-valued quantity. In my example, the 'MA' format with a linearly scaled magnitude and phase (usually given in degree) was used. There is also the 'dB' format with a decibel-scaled magnitude and again a linear phase (typically also given in degree) as well as an 'RI' format for the complex-valued scattering parameter given as a real part and imaginary part. So yes, your s2p file might have columns for the real and imaginary parts of the measured scattering parameters, at least if the file was saved in the corresponding 'RI' format. These scattering parameters (see en.wikipedia.org/wiki/Scattering_parameters) quantify the reflection at each port and transmission between each combination of two ports of a signaling system as a function of frequency. If you want to obtain the radiation pattern (see en.wikipedia.org/wiki/Radiation_pattern) of a radiating system, you need the emitted field strength or radiated power flux density (which is usually also frequency-dependent) as a function of the angles of the spherical coordinate system, i.e. the polar angle and the azimuth angle (see en.wikipedia.org/wiki/Spherical_coordinate_system), for each frequency of interest. Do you have this data? If not, you cannot plot a radiation pattern.
@shahnejad3132 жыл бұрын
What is the unit for magnitude? is it in dB?
@MathiasMagdowski2 жыл бұрын
No, the magnitude is not dB-scaled in this case. Scattering parameters of passive devices are always below 1 due to the conservation of energey, so always feature negative values in dB, because the logarithm of something positive but smaller than one is becoming negative. The magnitudes given in the file, which is shown in the video, are absolute unitless values.
@GaziSharif2 жыл бұрын
Great video. Thank you. Could you please tell how to extract components value (R, C, L) of the equivalent circuit from these obtained S parameters?
@MathiasMagdowski2 жыл бұрын
This is a difficult question. As this is kind of an inverse problem, there are lots of different methods to find a possible solution. I can recommend to think about a corresponding equivalent circuit that could fit your frequency-dependent impedance data. You can consider R, L and/or C in series or in parallel and combinations of these circuits. Then, you guess some starting values for the parameters R, L and C. To find the best fitting values, you can calculate the impedance and optimize the solution using functions like fminseach in MATLAB (see: de.mathworks.com/help/matlab/ref/fminsearch.html). Another option is to use so-called vector fitting (see: www.sintef.no/projectweb/vectorfitting/) I hope this helps.
@GaziSharif2 жыл бұрын
@@MathiasMagdowski Thank you very much. Highly appreciated.
@ladislavkalina65292 жыл бұрын
Load data for two port device is very easy, but how to load more than two ports device data into the Matlab? You can not use the same method because a frequency have one row, but data have four rows, so that is the problem for the load function because number of rows is different between columns.
@MathiasMagdowski2 жыл бұрын
Dear Ladislav Kalina, thanks for your inquiry. If you have more than two ports, the presented method should still work. In general, if you have n ports, you will get n² scattering parameters for each frequency point. So the corresponding Touchstone file (see en.wikipedia.org/wiki/Touchstone_file) will have n² + 1 columns and as many rows as there are frequency points (N_freq). Still it should be possible to import such a dataset using the 'load' function from MATLAB. The result will then be a corresponding matrix with N_freq rows and n² + 1 columns.
@bigdick84083 жыл бұрын
Great Video! I have a question. I have I and Q data that I would like to do the FFT on but my question is should I do the FFT on I then on Q? Or should I first concaténate to IQ=I +1j*Q then do the FFT on IQ? Thanks.
@MathiasMagdowski3 жыл бұрын
Good question! The FFT (Fast Fourier Transform) like the basic Fourier transform is a linear transform or linear mapping. This mean that if your transform your transient I(t) as a function of time t into a spectral I(f) as a function of frequency f, and do the same with Q(t) into Q(f), then IQ(f) will be the same as I(f) + j*Q(f) as well as the transform of IQ(t) = I(t) + j*Q(t) into IQ(f). You may also want to watch these videos: How to do a discrete Fourier transform (FFT) and to plot the amplitude and phase spectrum in MATLAB kzbin.info/www/bejne/kKe8eKSPhN6Yqc0 How to reconstruct a periodic signal as a sum of cosine functions from the freq. spectrum in MATLAB kzbin.info/www/bejne/hafchYWuj7iiorc How to do a fast Fourier transform (fft) in MATLAB to calculate the spectrum of data from a mat file kzbin.info/www/bejne/oYauoqWaYtGNeM0
@menamaurice27742 жыл бұрын
Great Video and very useful! However, I had a question. How can use a given s2p file and repeat the same but obtain the z and y parameters instead? Thanks
@MathiasMagdowski2 жыл бұрын
Sure, maybe I will add such a video later. In the meantime, you might want to look at en.wikipedia.org/wiki/Impedance_parameters#Relation_to_S-parameters and en.wikipedia.org/wiki/Admittance_parameters#Relation_to_S-parameters where the answer to that question is already explained quite well from my point of view.
@user-us8th9zn1g3 жыл бұрын
Gutes Video, nachhaltiger wäre es sicherlich gewesen, die 30sekunden aufzuwenden, zu erklären, wie man den Header skipped und keine manuelle Konvertierung vornimmt
@MathiasMagdowski3 жыл бұрын
Danke für das Lob. Das Übergehen des Dateikopfes kann man sicher machen, muss man aber nicht. 1. Problem: Andere Netzwerkanalysatoren erzeugen andere Formate des Dateikopfes. Die nötige Flexibilität benötigt eine gewisse Komplexizität bei der Umsetzung und sorgt vielleicht trotzdem für Überraschungen. 2. Problem: Natürlich gibt es MATLAB-Funktionen wie dlmread (de.mathworks.com/help/matlab/ref/dlmread.html) oder readmatrix (de.mathworks.com/help/matlab/ref/readmatrix.html), die automatisch mit Dateiköpfen in verschiedenen Formaten umgehen können. Die dlmread-Funktion gilt seit MATLAB 2019a aber als veraltet. Die neuere readmatrix-Funktion gibt es dafür (noch) nicht in GNU Octave oder Octave Online. Die load-Funktion gibt es überall. Die Datei ohne den Dateikopf wird sich auch ebenso problemlos in C, Python, Java, GNUplot oder mit dem pgfplots-Paket in LaTeX weiterverarbeiten lassen. 3. Problem: Auch wenn mir ein Programm den Dateikopf automatisch verarbeitet, würde ich trotzdem immer empfehlen, dort mal händisch reinzuschauen und den Inhalt zu prüfen (eben um Überraschungen zu vermeiden). 4. Problem: Das Einlesen, Weiterverarbeiten und Darstellen von Streuparametern geht natürlich auch mit der RF Toolbox in MATLAB (siehe de.mathworks.com/help/rf/ug/basic-operations-with-rf-objects.html). Das setzt aber natürlich die entsprechende lizenzpflichtige Toolbox voraus und funktioniert ebenso nicht in Octave. Nichtsdestotrotz kannst du natürlich mal einen Code-Schnipsel vorschlagen, mit dem du das Überspringen des Dateikopfes umsetzen würdest.