gpt4 book ai didi

matlab - Matlab中非数元素的索引

转载 作者:太空宇宙 更新时间:2023-11-03 20:34:56 25 4
gpt4 key购买 nike

我定义了一个数组,里面有传递函数。我怎样才能找到某个传递函数在该数组中的位置?

s = tf('s') % defining a transfer function
array = [s, s^2, s^3];
>> find(array==s)
undefined function 'eq' for input arguments of type 'tf'.

最佳答案

使用isequal 将数组的每个元素与 s 进行比较:

arrayfun(@(x)isequal(x,s),array)

关于matlab - Matlab中非数元素的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24621020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com