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?
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で RF Network Construction についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!