data(end) will not be available until simulation is completed. You can not use it in the test. Note that Simulink will not input a vector 'data'. At each iteration, 'data' will be a scalar number. Since you already now that data(end) is 1, so directly use it. Something like this
function Ts = fnc(data,t)
persistent flag
persistent T
if isempty(flag)
flag = 1;
T = 0;
end
if flag && (abs(data-1) < 0.05 * 1)
flag = false;
T = t;
end
Ts = T;
However, it will note the time when the output is rising, not when it is settling.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.