Error using chktransar​gs>getTime​Vector Expected T to be strictly increasing.

Trying to use the risetime/falltime functions and because I have negative and positive values in my time variable, I am getting this error. Please please help.
Here is my code:
load('ASRHsource.mat','t','v')
>> [R,LT,UT,LL,UL] = risetime(v,t,'StateLevels',[min(v),max(v)],'Tolerance',4,'PercentReferenceLevels',[10 90]) ; %#ok<*ASGLU>
risetime(v,t,'StateLevels',[min(v),max(v)],'Tolerance',4,'PercentReferenceLevels',[10 90])
trise = (ans*(1E9)); %#ok<*NOANS>
tr = num2str(trise);
Error using chktransargs>getTimeVector
Expected T to be strictly increasing.
Error in chktransargs (line 39)
t = getTimeVector(x, varargin{1:n-needDelay});
Error in transdurs (line 23)
[x, t, n] = chktransargs(0, sig, varargin{:});
Error in risetime (line 77)
[r,lwrCross,uprCross,lwrRef,uprRef] = transdurs(x,1,plotFlag,inpArgs{:});

6 件のコメント

%for debugging check
nnz(~isfinite(t)) %any nan or inf?
issorted(t) %are they out of order ?
issorted(t, 'strictascend') %if this fails but issorted worked then there are duplicates
numel(t) - numel(unique(t)) %non-zero implies non-nan duplicates
Hi there, this is what happened after I ran the program. Confused as to what I am supposed to do. Thanks for the help.
>> load('ASRHsource.mat')
>> %for debugging check
nnz(~isfinite(t)) %any nan or inf?
issorted(t) %are they out of order ?
issorted(t, 'strictascend') %if this fails but issorted worked then there are duplicates
numel(t) - numel(unique(t)) %non-zero implies non-nan duplicates
ans =
0
ans =
logical
1
ans =
logical
0
ans =
2699
Jasmine
Jasmine 2022 年 11 月 7 日
I am still getting that error that I originally have been getting.
Walter Roberson
Walter Roberson 2022 年 11 月 7 日
Your time vector is in ascending order but it has 2699 duplicate times. risetime() only works if the times are unique.
Gayatri Suvarchala
Gayatri Suvarchala 2022 年 12 月 28 日
Is there a better way to calculate rise time? Because there is always a likely hood of duplicate timestamps when we are recoding high resolution scope data.
Walter Roberson
Walter Roberson 2022 年 12 月 28 日
How are you "recoding" the data?
If you start with high resolution data with unique timestamps, and resample to lower resolution, then there are ways to only get out one sample per bin -- but you need to define how you want to merge the multiple samples. For example one potential way is to fft(), which takes into account all available information, and then to ifft to lower time resolution. But that is not always what is desired. Suppose for example that you are doing 2:1 on a signal with a strong peak every second bin; if you extract at times corresponding to the peaks you get one output but at times half way between you might get a very different signal. So you might want a different approach that tries to use more of the information per bin.

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2022 年 11 月 7 日

コメント済み:

2022 年 12 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by