Home > Software engineering >  How to 3D plot Complex Fraction: Voltage Reflection Coefficient With Increasing Reactance
How to 3D plot Complex Fraction: Voltage Reflection Coefficient With Increasing Reactance

Time:08-11

I am super struggling with this problem. I need to show in 3D how the magnitude of the Voltage Reflection Coefficient changes for a fixed Z_0 BUT with a changing Z_L, i.e. a changing load impedance.

It is not working at all and have no idea how to proceed. It seems MATLAB will not allow sum or difference operations for 3d plots.

clear,clc,cla,clf;

figure;

resistance = 0:10:400;
reactance = -400:10:400;

R = 50;     % Fixed resistance of Transmission Line
X = 0;      % Fixed reactance of Transmission Line

R_matrix = zeros(length(resistance),length(resistance));
R_matrix(:) = R;

X_matrix = zeros(length(reactance),length(reactance));
X_matrix(:) = X;


[RESISTANCE,REACTANCE] = meshgrid(resistance,reactance);


VRC = ((resistance - R_matrix).^2    (reactance - X_matrix).^2) ./ ((resistance   R_matrix).^2   (reactance - X_matrix).^2);

surf(RESISTANCE,REACTANCE,VRC);

xlabel('Resistance (\Omega)',"FontSize",14);
ylabel('Reactance X','FontSize',14);
zlabel('Voltage Reflection Coefficient','FontSize',14);

CodePudding user response:

The resistance and reactance cannot have different lengths. Use linspace(0,400) and linspace(-400,400) to make sure both have 100 values, for example.

clear, clc, close

resistance = linspace(0,400);
reactance = linspace(-400,400);

R = 50;     % Fixed resistance of Transmission Line
X = 0;      % Fixed reactance of Transmission Line

R_matrix(1:length(resistance),1:length(resistance)) = R;
X_matrix(1:length(reactance),1:length(reactance)) = X;

VRC = ((resistance - R_matrix).^2   (reactance - X_matrix).^2) ./ ...
      ((resistance   R_matrix).^2   (reactance   X_matrix).^2);

[RESISTANCE,REACTANCE] = meshgrid(resistance,reactance);
surf(RESISTANCE,REACTANCE,VRC);

xlabel('Resistance (\Omega)',"FontSize",14);
ylabel('Reactance X','FontSize',14);
zlabel('Voltage Reflection Coefficient','FontSize',14);

enter image description here

Edit: The reflection coefficient can only approach zero if ZL=Z0 because Γ=(ZL−Z0)/(ZL Z0). If you change resistance = 0:100 you will get Γ=0 at exactly resistance=50, because at resistance=50 the reactance is zero.

Just change this line:

resistance = linspace(0,100);

to get the following figure:

enter image description here

  • Related