Creating multiple circuit using same nport RF object in MATLAB with different node assignment?

조회 수: 1 (최근 30일)
I am trying to create multiple circuit using same RF objects having with different topology but getting an error shown below.
%% code for different topology
ckt = circuit('h1');
for i = 1:total_elements
add(ckt,[nport_node1(i) nport_node2(i)],nport_obj{i});
end
ckt1 = circuit('h2');
for i = 1:total_elements
add(ckt1,[nport_node2(i) nport_node1(i)],nport_obj{i});
end
%The error that I get
Error using rf.internal.circuit.Circuit/add
Cannot add nport 'Sparams' to circuit 'h2': nport 'Sparams' already belongs to a circuit.
Would you please let me know how can I create different topology using same circuit objects?

답변 (1개)

Namnendra
Namnendra 2023년 4월 27일
The error message suggests that you are trying to add the same `nport_obj` (which is an `S-parameters` object) to multiple circuits.
To create different circuits with different topologies, you should create separate `S-parameters` objects for each circuit. You can create the `S-parameters` objects outside the `for` loop and then use them in both circuits. Here's an example:
% create S-parameters object for circuit 1
sparams1 = rfdata.network;
sparams1.S = ... % define your S-parameters here
% create circuit 1
ckt1 = circuit('h1');
for i = 1:total_elements
add(ckt1, [nport_node1(i) nport_node2(i)], sparams1);
end
% create S-parameters object for circuit 2
sparams2 = rfdata.network;
sparams2.S = ... % define your S-parameters here
% create circuit 2
ckt2 = circuit('h2');
for i = 1:total_elements
add(ckt2, [nport_node2(i) nport_node1(i)], sparams2);
end
In this way, you can create multiple circuits with different topologies using different `S-parameters` objects.

카테고리

Help CenterFile Exchange에서 RF Network Construction에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by