clear all close all L= 30 lamda0 = 2.6 lamdac = 3 filename_list = dir ('*.s2p') filePathPath = 'D:\1zeeshan\1PeeHaaDee\data\Data_From_AnechCham_2022_09_21\2022_09_21_SITT'; for i=1:length(filename_list) fileNameWithPath = [ filePathPath '\' filename_list(i).name()]; sParam = sparameters(fileNameWithPath); freqGHz = sParam.Frequencies/1e9; s11 = squeeze(sParam.Parameters(1,1,:)); %s12 = squeeze(sParam.Parameters(1,2,:)); s21 = squeeze(sParam.Parameters(2,1,:)); X = ((s11.^2 - s21.^2)+1)./(2*(s11)) Refcof1 = X+sqrt((X.^2)-1) T = (s11+s21-Refcof1)./(1 - (s11+s21).*Refcof1) LN1T = log(1./T) ultaA = sqrt(-(((1/(2*pi*L)))*(LN1T)).^2) Ur = ultaA.*((1+Refcof1)./((1-Refcof1)*sqrt((1/lamda0^2)-(1/lamdac^2)))) Er(:,i) = Ur.*(((1-Refcof1).^2./(1+Refcof1).^2).*(1-(lamda0^2/lamdac^2))) + (lamda0^2/lamdac^2)*1./Ur Eabs = abs(Er) plot(freqGHz,Eabs) xlswrite('D:\file5.xlsx',[freqGHz,Eabs]) end