Properties (e.g. Name) are lost when adding a system to array of lti systems
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
When adding several systems to an array of subsystems, I lose the Name property.
e.g.
fc = 40; % Cross-over frequency in Hz
wc = 2*pi*fc;
lpf = ss(tf(1, [1/wc, 1], 'Name', 'LPF')); % LTI system of a 1st order low-pass filter
hpf = ss(tf([1/wc, 0], [1/wc, 1], 'Name', 'HPF')); % LTI system of a 1st order high-pass filter
sys(:,:,1,1) = lpf;
sys(:,:,1,2) = hpf;
The LTI systems lpf and hpf have the Name property set, but the array of LTI Systems sys doesn't have it anymore.
I pass the array to a custom function to create the Bode plots of both filters at once and I'd like to add the legend using the Name of the systems to identify the curves.
Trying to repair the omission by using the set command doesn't work
set(sys(:,:,1,1), 'Name', 'LPF');
This gives the error message
Error using DynamicSystem/set (line 7)
The first input argument of the "set" command must be a named variable.
Any ideas what may be causing this/what I am doing wrong?
0 Commenti
Risposte (1)
Pratyush Roy
il 5 Nov 2021
Hi Jan,
By design, LTI array itself has a name and it is shared when you index into array elements. For example:
sys.Name = 'xyz';
sys(:,:,1,2).Name % display 'xyz'
In other words, after you stack individual LTI systems into an array, the individual names will get lost and it is by design.
If retaining individual names are important, you can store LTI systems in a cell array as a workaround.
sys{1} = lpf;
sys{2} = hpf;
However, we would lose some benefits available only from LTI array such as using "bode(sys)".
Hope this helps!
Vedere anche
Categorie
Scopri di più su Get Started with Control System Toolbox 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!