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!