Simulink timeseries conversion into matrix

16 次查看(过去 30 天)
Hello,
I have a timeseries of Y positon output from simulink block. Y in converging to the steady state from t = 0 to t =50. I want to calculate the root mean square deviation(RMSD) of every second of input Y while simulating and check when it drops below the set thrushhold of RMSD. How to create a matrix of elements for each second and calculate the RMSD. When thrushhold for RMSD is reached output from matlab function should be 1 else 0.
This is how I post processed the data after importing into matlab from simulink. The same has to be implemented in simulink.
time = Y_position.Data(3500:end,1);
v = Y_position.Data;
mean = 2.063;
a = (time + mean);
N = size(time);
for ii = 1:N
b(ii,1) =(a(ii,1) )^2;
sumb = sum(b);
end
c = sum(a);
MSE = sumb/N(1,1) % Mean square error (MSE)
RMSD_ = sqrt(MSE) % Root Mean square Deviation (RMSD)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by