How can I determinate the delay and the time constant from script?
5 次查看(过去 30 天)
显示 更早的评论
Hi!
I have an input and an output vector, for example:
in=[0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1]
out=[0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 2; 12; 17; 20; 21; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22]
If you want to see it in a figure, type the following code to the Command Window:
in=[0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1];
out=[0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 2; 12; 17; 20; 21; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22; 22];
x=(1:1:30);
plot(x,in,'red')
hold
plot(x,out,'blue')
hold
I would like to determinate the delay and the time constant. I have System Identification Toolbox, and I can determinate the delay in GUI mode (Td=2.864), but I would like to determinate it in a matlab script. Which functions have to use, and how? Maybe I have to use the delayest function, but it doesn't works in this way:
DATA=iddata(out,in,0.1)
delayest(DATA)
The result is 0.
So I think this is not the right way. Can somebody write me an example to this two vector?
Thanks in advance!
0 个评论
回答(4 个)
Image Analyst
2013-2-18
What about just thresholding and using find()? Let's say that you say a signal starts when its amplitude exceeds some threshold:
thresholdValue = 0.5;
inStartTime = find(in > thresholdValue, 1, 'first')
outStartTime = find(out > thresholdValue, 1, 'first')
lagTime = outStartTime - inStartTime
0 个评论
Rajiv Singh
2013-2-19
Try impulse response estimation based approaches, assuming you are able to find a good FIR model for data (which you can ascertain using COMPARE)
m=impulseest(DATA); h = impulseplot(m); showConfidence(h,3)
The first response value that is significantly out of 3 sd region is at t = 0.3 which indicates a 3 sample (0.3 sec) delay. See:
1 个评论
Image Analyst
2013-2-20
This is not an answer. It is supposed to be a comment to someone but we don't know who because you posted it as an independent answer. Please copy it to a comment where it belongs.
Ákos
2013-2-20
编辑:Ákos
2013-2-20
1 个评论
Image Analyst
2013-2-20
This is not an answer. It is supposed to be a comment to someone but we don't know who because you posted it as an independent answer. Please copy it to a comment where it belongs.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Correlation Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!