How do I make ports in RF toolbox with complex port impedances?

8 views (last 30 days)
I am trying to make a circuit in RF toolbox with one port being a complex non-50 ohm port impedance. Say 10+5j.
As I understand it setports is defined like this however this is assuming all 50 ohm ports. How do I change the reference impedance of the port from node 1/2. and keep the 3/2 node still as 50 ohm.
ckt = circuit("cir")
setports(ckt, [1 2], [3 2])

Answers (1)

Jack
Jack on 7 Mar 2025
Edited: Rik on 12 Mar 2025
Hey Tony,
Here’s how you can set one port to 10 + 5j ohms while keeping another at 50 ohms:
ckt = circuit("cir");
addport(ckt, [1 2], 'Z', 10 + 5j);
addport(ckt, [3 2], 'Z', 50);
This explicitly sets the port impedance when defining the ports, so you’re not stuck with 50 ohms everywhere.
Follow me so you can message me anytime with future MATLAB questions.
  5 Comments
Tony
Tony on 7 Mar 2025
ckt = circuit("cir");
% Add a series impedance to create a complex port impedance
z_complex = 10 + 5j;
z_standard = 50;
z1 = rfckt.series('R', real(z_complex), 'L', imag(z_complex) / (2 * pi * 1e9)); % Example at 1 GHz
Error using rfckt.rfckt>setdata1 (line 236)
Series Connected Network: RFdata must be an RFDATA.DATA object.

Error in rfckt.rfckt/set.RFdata (line 121)
obj.RFdata = setdata1(obj,value,'RFdata');

Error in rfckt.series (line 107)
set(h,varargin{:});
add(ckt, z1, [1 2]);
% Define ports
setports(ckt, [1 2], [3 2], z_standard);
Rik
Rik on 12 Mar 2025
@Jack Using tools (e.g. an LLM) to create answers/comments is allowed, however, it is up to the user to verify the correctness of such automatic content, and to apply edits as needed.
An easy way to verify your code works, is to format your code as code and run it. As you can see, your code tends to result in an error.
There is no shame in not knowing the answer to a question. There is shame in blindly posting something an LLM generated and presenting it as an answer without even bothering to test the code runs without error.

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!