# Input Port and S parameter Simulink Matlab, Calculation Wrong

Status
Not open for further replies.

#### votientu

##### Member level 2
Hello,

I am modeling a balun block in Simulink which have an imported S parameter.

I have a pulse signal in UWB at the input (in the array r1Ant) then in Simulink it passes a input port and S parameters block, then the output is r1_balun_1.

The spectrum of output signal in Simulink is quite different to the spectrum calculated by theoretical calculation.
Could you help me to explain why ?

Thanks !

%% Input parameter
Ts = 1/4e9;
fc = 8e9;
tdelay = 10e-9;
deltaF = 25e6; % Time max in Simulink 40e-9
f = (0:deltaF:1/Ts)';
t = (0:Ts:Ts*(length(f)-1))';

tau = 0.5e-9;
phase1 = 20/180*pi;
N = length(t);
r1Input = zeros(1,N)';

for k=1:N
% Gaussian envelop
p = exp(-(t(k)-tdelay).^2/2/tau^2);
% UWB Pulse
r1Input(k) = p .* exp(2i*pi*fc*(t(k)-tdelay)+1i*phase1);
end

r1Ant.time = t;
r1Ant.signals.values = r1Input;
r1Ant.signals.dimensions = 1;

%% Theoretical Calculation
balun_1 = sparameters('rat_21.s2p');
balun_1_S21 = balun_1.Parameters(2,1,;
balun_1_S21 = reshape(balun_1_S21,length(f),1);
R1_balun_1_cal = balun_1_S21.*fftshift(fft(r1Input));
r1_balun_1_cal = ifft(ifftshift(R1_balun_1_cal));

%% Compare theoretical calculation and Simulink
figure();
plot(f, 20*log10(abs(fftshift(fft(r1_balun_1))))); hold on;
plot(f, 20*log10(abs(fftshift(fft(r1_balun_1_cal))))); hold on;

Last edited:

Status
Not open for further replies.