How do I export data from an .s2p file in MATLAB?
139 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a sequence of .s2p touchstone files that I need to analyze data from. I am currently using the RF toolbox and have used these commands to export the data:
%load in touchstone s2p data file
data = read(rfdata.data,myfilename);
%sort by data
freq = data.Freq;
s_params = extract(data,'S_PARAMETERS',50);
% data
s11 = s_params(1,1,:);
s22 = s_params(2,2,:);
s21 = s_params(2,1,:);
s12 = s_params(1,2,:);
However, I'd prefer to export the data in a more manual way and not use the toolbox command, because I'm not sure if it is identifying the correct columns of data... it doesn't make 100% sense when I do this. Is there a way I can open the file and import the file as a matrix then seperate out the data? I'm thinking of using something like this:
f = myfilename(:,1); ReS11 = myfilename(:,2); ImS11 = myfilename(:,3); ReS21 = myfilename(:,4); ImS21 = myfilename(:,5); ReS12 = myfilename(:,6); ImS12 = myfilename(:,7); ReS22 = myfilename(:,8); ImS22 = myfilename(:,9);
%Creating the S Parameter Matrix
s11=ReS11+1i*(ImS11);
s12=ReS12+1i*(ImS12);
s21=ReS21+1i*(ImS21);
s22=ReS22+1i*(ImS22);
I just am not sure how to actually get the data imported into my MATLAB script in an automated way. Please help!
Thanks,
2 个评论
Walter Roberson
2018-11-27
The full file format appears to be described at http://na.support.keysight.com/plts/help/WebHelp/FilePrint/SnP_File_Format.htm
采纳的回答
Mark
2022-6-7
The RF Toolbox offers an sparameters object that can read in and manipulate data from Touchstone files
>> obj = sparameters('passive.s2p')
obj =
sparameters: S-parameters object
NumPorts: 2
Frequencies: [202×1 double]
Parameters: [2×2×202 double]
Impedance: 50
rfparam(obj,i,j) returns S-parameter Sij
The RF Toolbox also offers many functions for manipulating and plotting S-parameter data.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visualization and Data Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!