Effacer les filtres
Effacer les filtres

Error using tsa function - Error using matlab.int​ernal.math​.interp1 Sample points must be unique.

20 vues (au cours des 30 derniers jours)
While I've allready succesfully used the tsa function in the past, I stumbled upon the error as shown below, which I'm not able to get rid of. Intuitively I tried using the unique function to exclude possible duplicates in my TachoPulseTimes vector, but this didn't appear to solve the issue. I also tried swapping the sampling frequency argument fs for the corresponding time vector to make sure both the sampling time vector and tacho pulse times would start and end on equal time stamps, but with no luck. Any help would be much appriciated given I'm completly stuck at the moment.
load('TSA_DATA.mat')
AccData = upsample(tsaData.AccData,100);
fs = tsaData.SampFreq;
TachoPulseTimes = tsaData.TachoPulseTimes;
pprTacho = tsaData.pprTacho;
accDataTsaRaw = tsa(AccData,fs,TachoPulseTimes,"PulsesPerRotation",pprTacho);
Note: The accelerometer data was downsampled with a factor 100 to be able to include the data as attachment
Many thanks in advance,
Lars
  9 commentaires
Lars Dierickx
Lars Dierickx le 18 Avr 2024
The data set it last worked on contained a smaller amount of samples, but measured on the same setup.
I also just noticed that when processing the old data I used an estimation of the sampling frequency 100kHz in comparison to the real sampling frequency of 102.4kHz as shown above. In addition the data was also processed for a different accelerometer, but I highly doubt this would be the culprit.
Let me first run again my old code adjusting these parameters, after which I will provide the old data set if needed.
Lars Dierickx
Lars Dierickx le 18 Avr 2024
Modifié(e) : Torsten le 18 Avr 2024
Here is the old (working) data set which does not yield the error.
load('TSA_DATA_OLD.mat')
tsaData = struct with fields:
AccData: [-2.3163 0.6736 0.8462 0.7098 1.2671 1.0169 -2.3191 0.9164 0.6931 0.4014 0.2219 0.9967 1.4735 -0.1119 0.4298 2.3337 -1.2249 0.3470 ... ] (1x16501 double) SampFreq: 104200 TachoPulseTimes: [0 0.0072 0.0144 0.0214 0.0286 0.0357 0.0430 0.0499 0.0570 0.0642 0.0771 0.0906 0.0966 0.1037 0.1109 0.1182 0.1253 0.1324 0.1396 0.1468 ... ] (1x2168 single) pprTacho: 64
AccData = upsample(tsaData.AccData,100);
fs = tsaData.SampFreq;
TachoPulseTimes = tsaData.TachoPulseTimes;
pprTacho = tsaData.pprTacho;
accDataTsaRaw = tsa(AccData,fs,TachoPulseTimes,"PulsesPerRotation",pprTacho);
Warning: Truncating TP to the time range of X.

Connectez-vous pour commenter.

Réponse acceptée

Mathieu NOE
Mathieu NOE le 19 Avr 2024
Modifié(e) : Mathieu NOE le 19 Avr 2024
hehe
there is only one difference between the two mat files , but it was enough to create the issue
>> load('TSA_DATA_OLD.mat') => AccData: [1×16501 double]
>> load('TSA_DATA.mat') => AccData: [1×254977 single]
so in the second case , don't forget to convert from single to double before calling tsa
AccData = upsample(double(tsaData.AccData),100)
  3 commentaires
Lars Dierickx
Lars Dierickx le 19 Avr 2024
As a last comment, I indeed remember exporting my larger data set in single precision format as opposed to double precision for my old data. This was due to the file size limit of Siemens Signature Acquisition.
Mathieu NOE
Mathieu NOE le 19 Avr 2024
maybe something worth to write as a comment in your code ...
all the best

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by