Filter löschen
Filter löschen

Matlab Codes_s parameter to transmission line parameters conversion

3 Ansichten (letzte 30 Tage)
padoh
padoh am 27 Nov. 2013
Kommentiert: padoh am 27 Nov. 2013
Consider two structures in cascade
I wil name the combined structure as C.
I have the s-parameters for the structure A and for the overall structure C. I want to extract the s-param for the structure B. i need to use matlab for the purpose.
The technique i have chosen is to convert S-param to transmission param (or ABCD param), since for a cascaded structure like above the ABCD parameters would be
[Tc]=[Ta][Tb]
where Tc=transmission param for combined structure Ta=transmission param for structure A Tb=transmission param for structure B
to find Tb i can do the following computations: [Tc][Ta]-1=[Tb]
So in the maTLAB code attached below, i have taken the s2p (sparam file) for structure A, converetd it to t param( infact the ABCD param), then taken the s2p file for C and multiplied both matrices. the end result is converted back to s-param file, since i want my answer in s-param. Please note that the matrices used here are 3D matrices.
i have written the code but the answers are wrong. there are no errors. but the answers are not matching with the s-param i have for structure B. Can neone plz help?
it doesnt matter if the code is slow etc. All i want is the correct ans.
file = 'C:\Users\abc\A.s2p'; h = read(rfdata.data,file); % Read s-param file containing the s-param for structure A into data object. [outmatrix, freq] = extract(h,'S',50); %extracting s-param from the file abcd_params_h = s2t(outmatrix); %converting to ABCD param
a=abcd_params_h
for j=1:127 bi=inv(a(:,:,j));
eval(['A' num2str(j) '=bi']);
end
%where A1, A2 etc are the inverse of transmission param for the test structure and have to be multiplied with the transmission param for total structure % c=cat (3,A1,A2,A3,A4,A5);
file2 = 'C:\Users\abc\C.s2p'; h1 = read(rfdata.data,file2); % Read s-param file containing the s-param for structure C into data object [outmatrix1, freq] = extract(h1,'S',50); %extracting s-param from the file abcd_params_h1 = s2t(outmatrix1); %converting
b=abcd_params_h1;
for j=1:127 bi=(b(:,:,j));
eval(['B' num2str(j) '=bi']);
end %where B1, B2 etc are the transmission param for the total structure and %have to be multiplied with the inverse transmission param generated above using %outmatrix
% c=cat (3,B1,B2,B3,B4,B5)
C1=A1*B1
C2=A2*B2
C3=A3*B3
C4=A4*B4
C5=A5*B5
C6=A6*B6
C7=A7*B7
C8=A8*B8
C9=A9*B9
C10=A10*B10
C11=A11*B11
C12=A12*B12
C13=A13*B13
C14=A14*B14
C15=A15*B15
C16=A16*B16
C17=A17*B17
C18=A18*B18
C19=A19*B19
C20=A20*B20
C21=A21*B21
C22=A22*B22
C23=A23*B23
C24=A24*B24
C25=A25*B25
C26=A26*B26
C27=A27*B27
C28=A28*B28
C29=A29*B29
C30=A30*B30
C31=A31*B31
C32=A32*B32
C33=A33*B33
C34=A34*B34
C35=A35*B35
C36=A36*B36
C37=A37*B37
C38=A38*B38
C39=A39*B39
C40=A40*B40 C41=A41*B41
C42=A42*B42
C43=A43*B43
C44=A44*B44
C45=A45*B45
C46=A46*B46
C47=A47*B47
C48=A48*B48
C49=A49*B49
C50=A50*B50
C51=A51*B51
C52=A52*B52
C53=A53*B53
C54=A54*B54
C55=A55*B55
C56=A56*B56
C57=A57*B57
C58=A58*B58
C59=A59*B59 C60=A60*B60
C61=A61*B61
C62=A62*B62
C63=A63*B63
C64=A64*B64
C65=A65*B65
C66=A66*B66
C67=A67*B67
C68=A68*B68
C69=A69*B69
C70=A70*B70
C71=A71*B71
C72=A72*B72
C73=A73*B73
C74=A74*B74
C75=A75*B75
C76=A76*B76
C77=A77*B77
C78=A78*B78
C79=A79*B79
C80=A80*B80
C81=A81*B81
C82=A82*B82
C83=A83*B83
C84=A84*B84
C85=A85*B85
C86=A86*B86
C87=A87*B87
C88=A88*B88
C89=A89*B89 C90=A90*B90
C91=A91*B91
C92=A92*B92
C93=A93*B93
C94=A94*B94
C95=A95*B95
C96=A96*B96
C97=A97*B97
C98=A98*B98
C99=A99*B99
C100=A100*B100
C101=A101*B101
C102=A102*B102
C103=A103*B103
C104=A104*B104
C105=A105*B105
C106=A106*B106
C107=A107*B107
C108=A108*B108
C109=A109*B109
C110=A110*B110
C111=A111*B111
C112=A112*B112
C113=A113*B113
C114=A114*B114
C115=A115*B115
C116=A116*B116
C117=A117*B117
C118=A118*B118
C119=A119*B119
C120=A120*B120
C121=A121*B121
C122=A122*B122
C123=A123*B123
C124=A124*B124
C125=A125*B125
C126=A126*B126
C127=A127*B127
outmatrix2=cat (3,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14, C15,C16,C17,C18,C19,C20,C21,C22,C23,C24,C25,C26,C2 7,C28,C29,C30,C31,C32,C33,C34,C35,C36,C37,C38,C39, C40,C41,C42,C43,C44,C45,C46,C47,C48,C49,C50,C51,C5 2,C53,C54,C55,C56,C57,C58,C59,C60,C61,C62,C63,C64, C65,C66,C67,C68,C69,C70,C71,C72,C73,C74,C75,C76,C7 7,C78,C79,C80,C81,C82,C83,C84,C85,C86,C87,C88,C89, C90,C91,C92,C93,C94,C95,C96,C97,C98,C99,C100,C101, C102,C103,C104,C105,C106,C107,C108,C109,C110,C111, C112,C113,C114,C115,C116,C117,C118,C119,C120,C121, C122,C123,C124,C125,C126,C127)
%now we have obtained the transmission parameters for B structure only %and we have to convert it to s-param and get the s2p file from which we %can plot curve etc
s_params_h2 = t2s(outmatrix2); %converting
txdata = rfdata.data; txdata.S_Parameters = outmatrix2; txdata.Freq=freq write(txdata,'C:\Users\abc\B.s2p')
somebody plz help :(

Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by