calculating the time constant

46 vues (au cours des 30 derniers jours)
Hassan
Hassan le 13 Oct 2012
I have a vector represent a step change, and I want to calculate the time constant of it, "the time it takes to reach 63%". the vector that represent the step change is as below:
y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0001 0.0006 0.0029 0.0108 0.0266 0.0583 0.1212 0.2361 0.3877 0.5089 0.6059 0.6833 0.7453 0.7948 0.8343 0.8660 0.8913 0.9115 0.9276 0.9405 0.9509 0.9591 0.9657 0.9710 0.9752 0.9786 0.9813 0.9834 0.9851 0.9865 0.9876 0.9885 0.9892 0.9898 0.9902 0.9906 0.9909 0.9911 0.9913 0.9914 0.9915 0.9916 0.9917 0.9918 0.9918 0.9918 0.9919 0.9919 0.9919 0.9919 0.9920 0.9920
if you made a plot to the Y vector in the matlab it will give you step function from 0 to 0.9405, I just want to calculate the time it takes to reach 0.63 from the step, which by eye can be detrmind at aprox. 27
I need a formula to calculate it automatically please advise
  2 commentaires
Walter Roberson
Walter Roberson le 13 Oct 2012
Please examine the guide to tags and retag this question; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Azzi Abdelmalek
Azzi Abdelmalek le 13 Oct 2012
You mean 63% from the y(end)

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 13 Oct 2012
Modifié(e) : Azzi Abdelmalek le 13 Oct 2012
yi=y(end)
idx=max(find(abs(y-yi)>=0.37*yi))
% idx the corresponding index
  1 commentaire
Hassan
Hassan le 14 Oct 2012
Thanks alot Azzi, It really worked very well... Appreciating all your efforts.

Connectez-vous pour commenter.

Plus de réponses (1)

Ákos
Ákos le 18 Fév 2013
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!
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 18 Fév 2013
Ákos, This is expected to be an answer. If you want to get more chance to have an answer, post a new question.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by