Using smithplot for a smith chart, can't get normalized impedance values to display properly

2 views (last 30 days)
Hey guys. As the title suggests, I've been trying to plot the normalized impedance values depending on ω, however when I call the command, the values are horribly misaligned. Refer to the code and the screenshot for further info. What am I doing wrong?
clc;
s = smithplot;
% Define the frequency range (20 MHz to 50 MHz)
f_start = 20e6;
f_stop = 50e6;
f_step = 1e6;
f = f_start:f_step:f_stop;
% Define the load parameters
C = 200e-12;
L = 100e-9;
R = 1000;
% Calculate the angular frequency
omega = 2*pi*f;
% Calculate the reactance
X = omega * L - 1 ./ (omega * C);
% Calculate the impedance of the load
ZL = R + 1i * X;
% Define the characteristic impedance of the transmission line (Z0 = 120 * pi Ohms)
Z0 = 120 * pi;
% Normalize the impedance of the load
ZL_normalized = ZL / Z0;
% Plot the normalized impedance on a Smith chart
hold all;
plot(real(ZL_normalized),imag(ZL_normalized),'LineWidth',2);
  2 Comments
Star Strider
Star Strider on 17 Feb 2023
You need to plot directly to the smithplot.
Try something like this —
% clc;
% s = smithplot;
% Define the frequency range (20 MHz to 50 MHz)
f_start = 20e6;
f_stop = 50e6;
f_step = 1e6;
f = f_start:f_step:f_stop;
% Define the load parameters
C = 200e-12;
L = 100e-9;
R = 1000;
% Calculate the angular frequency
omega = 2*pi*f;
% Calculate the reactance
X = omega * L - 1 ./ (omega * C);
% Calculate the impedance of the load
ZL = R + 1i * X;
% Define the characteristic impedance of the transmission line (Z0 = 120 * pi Ohms)
Z0 = 120 * pi;
% Normalize the impedance of the load
ZL_normalized = ZL / Z0;
% Plot the normalized impedance on a Smith chart
hold all;
s = smithplot(real(ZL_normalized),imag(ZL_normalized),'LineWidth',2);
I do not know what you are plotting, and while I understand about Smith charts, I do not have any of the Toolboxes that support them, so I have no direct experience with them in MATLAB.
.
Emre Hayatoglu
Emre Hayatoglu on 17 Feb 2023
I fixed the issue with the following code:
hckt = circuit('new_circuit1');
hC1= add(hckt,[1 2],capacitor(200e-12));
hR1 = add(hckt,[2 3],resistor(1000));
hL1 = add(hckt,[3,4],inductor(100e-9));
setports (hckt,[1 4]);
disp(hckt)
freq = linspace(20e6,50e6);
ckt_sparameters = sparameters(hckt,freq,120*pi);
hold all;
smithplot(ckt_sparameters,[1,1],'LegendLabels','Reflection Coefficient');
Which returns the plot:
The task was the following by the way:

Sign in to comment.

Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!