Properties (e.g. Name) are lost when adding a system to array of lti systems
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Pratyush Roy
2021년 11월 5일
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!
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Control System Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!