Creating multiple circuit using same nport RF object in MATLAB with different node assignment?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Namnendra
il 27 Apr 2023
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 Commenti
Vedere anche
Categorie
Scopri di più su RF Network Construction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!