Get frequency from sparameter object
14 views (last 30 days)
Frederikke Johansson on 26 Feb 2020
I have imported a touchstone file (s2p) to an sparameter object using sparameters function in RF Toolbox:
I want to get the frequency vector from Example_s_param. I can see it when using disp(Example_s_param) - then it returns:
Frequencies: [1001×1 double]
Parameters: [2×2×1001 double]
I want to save the "Frequncies" in a new vector I can use to plot stuff. Somehow I cannot figure out how to do this.
Payas Bahade on 17 Mar 2020
‘Example_s_param’ is a structure with 4 fields viz. NumPorts, Frequencies, Parameters and Impedance. To access values in these fields, dot notation is used. For example:
S = sparameters('default.s2p');
Freq = S.Frequencies; % Storing 'Frequencies' field values from Structure 'S' into variable Freq
You can use following code to store frequencies as new vector:
Freq = Example_s_param.Frequencies;
For more details on accessing data in structure array, please refer this documentation.
Hope this helps!