Search code examples
matlab3d

How to 3D plot Complex Fraction: Voltage Reflection Coefficient With Increasing Reactance


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);


Solution

  • This is a new answer to address the enquiries raised by the OP in comments:

    resistance = linspace(0,99);
    reactance = linspace(-100,100);
    R = 50;     % Fixed resistance of Transmission Line
    X = 0;      % Fixed reactance of Transmission Line
    
    % 2D plot:
    VRC = ((resistance - R).^2 + (reactance - X).^2) ./ ...
          ((resistance + R).^2 + (reactance + X).^2);
    plot(resistance,VRC,reactance,VRC)
    xlabel('Resistance (\Omega), Reactance X',"FontSize",12);
    ylabel('Voltage Reflection Coefficient','FontSize',12);
    
    % 3D plot:
    [RESISTANCE,REACTANCE] = meshgrid(resistance,reactance);
    VRC = ((RESISTANCE - R).^2 + (REACTANCE - X).^2) ./ ...
          ((RESISTANCE + R).^2 + (REACTANCE + X).^2);
    figure
    surf(RESISTANCE,REACTANCE,VRC);
    xlabel('Resistance (\Omega)',"FontSize",12);
    ylabel('Reactance X','FontSize',12);
    zlabel('Voltage Reflection Coefficient','FontSize',12);
    

    enter image description here

    enter image description here