Error using chktransargs>getTimeVector Expected T to be strictly increasing.
Show older comments
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 Comments
Walter Roberson
on 7 Nov 2022
%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
Jasmine
on 7 Nov 2022
Jasmine
on 7 Nov 2022
Walter Roberson
on 7 Nov 2022
Your time vector is in ascending order but it has 2699 duplicate times. risetime() only works if the times are unique.
Gayatri Suvarchala
on 28 Dec 2022
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
on 28 Dec 2022
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.
Answers (0)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!