How can I solve this error when I use Trapz ?

1 次查看(过去 30 天)
I keep getting this error when I run my program.
err = 1-y; %Define error signal
t = 0 : 0.01 :30;
ise = trapz (1,err.^2);
-------
Error using trapz (line 47)
Dimension argument must be a positive integer scalar within indexing range.
Undefined operator '.^' for input arguments of type 'timeseries'.
y here is output data from a block diagarm simulink.
any solutions?

采纳的回答

Ameer Hamza
Ameer Hamza 2020-4-17
Try this
err = 1 - y.Data; %Define error signal
ise = trapz(y.Time, err.^2);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by