- Check Data Length: Ensure that the State of Charge (SoC) data series contains more than two data points. This can be done by checking the length or size of the data array. For example, in MATLAB, use length(data) or size(data,1) if your data is in a column vector. Verify that the data points are evenly spaced in time (i.e., consistent sample rate).
- Verify Data Passed to Function: Make sure the data that is passed to the rainflow function is correctly referenced. Sometimes, a mistake in variable naming or indexing might lead to passing an empty array or a subset of the data that's too small. Check if there are any missing data points or irregularities in the dataset.
- Sample Rate "fs": Ensure that the sample rate "fs" is correctly defined and passed to the function alongside your data. Ensure that the sample rate (fs) matches the actual time interval between data points in your State of Charge (SoC) dataset. If the sample rate is too high or too low, it could affect the number of samples available for the rainflow algorithm.
- Data Format: The rainflow function expects the input time series data in a specific format (usually a vector). Ensure that the SoC data is in the correct format. If you're manipulating the data before passing it to the function, ensure these manipulations do not change the data's length unintentionally (e.g., turning it into a scalar or a 2-element array).
Rainflow Algorithm needs 3 samples
4 views (last 30 days)
Show older comments
Hi,
I want to use the build-in rainflow(x,fs) algorithm to calculate the cycles a battery model has run by using it on the State of Charge (&) of the cell. When I try to use the algorithm on the SoC (see picture) I get the following error:
Input time series must have at least 3 samples.
But I set a sample rate fs and as you can see in the picture there is also enough data.
Anyone knows why?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/522532/image.bmp)
0 Comments
Answers (1)
Abhimenyu
on 31 May 2024
Hi,
I understand that you are encountering an issue with the rainflow function, which is typically used for counting cycles in a signal, and often for fatigue analysis. The error message you're seeing suggests that the function is not receiving enough data points from the input. Please follow the below-mentioned reasons and recommendations to troubleshoot the issue:
Please follow this MATLAB R2024a documentation link to understand more about the rainflow function: https://www.mathworks.com/help/signal/ref/rainflow.html
I hope this helps to resolve your query!
0 Comments
See Also
Categories
Find more on Vibration Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!