How do I export data from an .s2p file in MATLAB?
140 ビュー (過去 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!