- Loading and preparing data.
- Comparing and grouping time series by similarity.
- Identifying time series with highest and lowest values with low variability.
comparing time series data and grouping
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have radiation data in time series in every 5 min during month so I wanted to compire days with each other (compire time serieses) and group them according to similerity.
Could you kinldy help me with how to do this annalysis in matlab. I am new to matlab
I need;
1. Compire differant time seriesies of differant dates and group the similerity, somthing like this;
Day Grouping
day01 a
day02 ab
day 03 b
..... .....
2. Need to find the time seriese with higerst values and low variability
3. Need to find the time seriese with lowest values and low variabilty
Data stored in a mat file DATA (data are nonlinear)
(:,1) is date (:,2) is time and (:,3) is the reading i have. (readings are changing with time)
Date Time Readings
01 06.00 0.500
01 06.05 0.450
01 ... ...
01 19.00 0.235
02 06.00 0.700
02 06.05 0.650
02 ... ...
02 19.00 0.335
... ... ...
31 19.00 0.432
Could you kindly helpme find the test ishould use to do this and matlab codes to do this. I am Highly appriciating your advicers ..
0 commentaires
Réponses (1)
Arjun
le 4 Nov 2024 à 14:17
I understand that you have a dataset containing radiation data and you want to group similar data and perform some analysis on top of it.
Since nothing is mentioned about the algorithm for grouping data, lets assume “k-means” clustering as the grouping algorithm. We can divide the entire task into three main chunks which are as follows:
Kindly refer to the code below for better understanding:
% Load the data, part 1 of the task
load('DATA.mat');
dates = DATA(:, 1);
times = DATA(:, 2);
readings = DATA(:, 3);
dataTable = table(dates, times, readings);
% Get unique days
uniqueDays = unique(dates);
% Reshape data into matrix form where each row is a day
numDays = length(uniqueDays);
numTimePoints = sum(dates == uniqueDays(1));
dataMatrix = reshape(readings, numTimePoints, numDays)';
% Normalize data (optional, depending on your data characteristics)
dataMatrix = zscore(dataMatrix, 0, 2);
% Perform k-means clustering- grouping the data, part 2 of task
numClusters = 3;
[idx, ~] = kmeans(dataMatrix, numClusters);
% Create a grouping table
groupingTable = table(uniqueDays, idx, 'VariableNames', {'Day', 'Group'});
disp(groupingTable);
% Calculate mean and standard deviation for each day- part 3 of the task
means = mean(dataMatrix, 2);
stdDevs = std(dataMatrix, 0, 2);
% Define a threshold for low variability
threshold = 0.1;
lowVarIndices = stdDevs < threshold;
if any(lowVarIndices)
highMeanLowVar = uniqueDays(lowVarIndices & means == max(means(lowVarIndices)));
lowMeanLowVar = uniqueDays(lowVarIndices & means == min(means(lowVarIndices)));
else
highMeanLowVar = [];
lowMeanLowVar = [];
end
disp('Day with highest mean and low variability:');
disp(highMeanLowVar);
disp('Day with lowest mean and low variability:');
disp(lowMeanLowVar);
Kindly refer to the following documentation link for more information on “k-means” algorithm: https://www.mathworks.com/help/stats/kmeans.html
I hope this will help!
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!