Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.7 kB
1
Indexable
Never
#######################################################################

% Impedance Parameters (Z-parameters) Example

% Given impedance matrix
Z11 = 3 + 4j;
Z12 = 2 + 2j;
Z21 = 1 + 1j;
Z22 = 2 + 3j;

% Generate a range of input currents
I1 = linspace(0, 5, 100);

% Calculate corresponding output voltages using Z-parameters
V2 = Z21 * I1 + Z22 * 2;  % Assume V2 = 2 for simplicity

% Plot input current vs. output voltage
figure;
plot(I1, real(V2), 'b', I1, imag(V2), 'r');
xlabel('Input Current (I1)');
ylabel('Output Voltage (V2)');
title('Impedance Parameters (Z-parameters) Example');
legend('Real(V2)', 'Imag(V2)');
grid on;

#######################################################################

% Admittance Parameters (Y-parameters) Example

% Given admittance matrix
Y11 = 0.2 - 0.3j;
Y12 = 0.1 + 0.2j;
Y21 = 0.15 + 0.1j;
Y22 = 0.3 - 0.4j;

% Generate a range of input voltages
V1 = linspace(0, 3, 100);

% Calculate corresponding output currents using Y-parameters
I2 = Y21 * V1 + Y22 * 1;  % Assume I2 = 1 for simplicity

% Plot input voltage vs. output current
figure;
plot(V1, real(I2), 'b', V1, imag(I2), 'r');
xlabel('Input Voltage (V1)');
ylabel('Output Current (I2)');
title('Admittance Parameters (Y-parameters) Example');
legend('Real(I2)', 'Imag(I2)');
grid on;

#######################################################################

% Hybrid Parameters (H-parameters) Example

% Given hybrid matrix
h11 = 0.5 + 0.2j;
h12 = 0.1 - 0.3j;
h21 = 0.3 - 0.1j;
h22 = 0.6 + 0.4j;

% Generate a range of input currents
I1 = linspace(0, 2, 100);

% Calculate corresponding output voltages using H-parameters
V2 = h21 * I1 + h22 * 2;  % Assume V2 = 2 for simplicity

% Plot input current vs. output voltage
figure;
plot(I1, real(V2), 'b', I1, imag(V2), 'r');
xlabel('Input Current (I1)');
ylabel('Output Voltage (V2)');
title('Hybrid Parameters (H-parameters) Example');
legend('Real(V2)', 'Imag(V2)');
grid on;

#######################################################################

% Scattering Parameters (S-parameters) Example

% Given scattering matrix
S11 = 0.8 + 0.2j;
S12 = 0.3 - 0.1j;
S21 = 0.4 - 0.3j;
S22 = 0.7 + 0.5j;

% Generate a range of incident waves
a1 = linspace(0, 1, 100);

% Calculate corresponding reflected waves using S-parameters
b2 = S21 * a1 + S22 * 0;  % Assume b2 = 0 for simplicity

% Plot incident wave vs. reflected wave
figure;
plot(a1, real(b2), 'b', a1, imag(b2), 'r');
xlabel('Incident Wave Amplitude (a1)');
ylabel('Reflected Wave Amplitude (b2)');
title('Scattering Parameters (S-parameters) Example');
legend('Real(b2)', 'Imag(b2)');
grid on;

#######################################################################