I want to know the method for removing excessive angle data.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1631236/image.png)
I want to remove data, if current direction larger or smaller about mean current direction +15, - 15(degree), respectively.
First figre, I can remove data by up and down line(mean current direction +15 or -15)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1631241/image.png)
But case of Figure2, some datas exceed 360(degree), So I don't how to remove unneedful data....
4 comentarios
Mann Baidi
el 29 de Feb. de 2024
for i = 1:length(Current_dir)
indind{i} = find(Current_dir(i,:) > mean_Current_dir(i) + 15 | Current_dir(i,:) < mean_Current_dir(i) - 15);
end
What is the significance of 'indind' variable?
Respuestas (1)
Mathieu NOE
el 29 de Feb. de 2024
hello @재혁
IMO , there is no need to use a for loop to compute 'indind' variable
also nanmean is obsolete, you can use mean with 'omitnan' option instead.
here a very simplified code to show how to remove (replace) values exceeding your limits with NaN's
Current_dir = 45*rand(100,1); % random numbers between 0 and 45
% mean_Current_dir = nanmean(Current_dir,2); obsolete
mean_Current_dir = mean(Current_dir,'omitnan');
%% No need for a for loop here
% for i = 1:length(Current_dir)
% indind{i} = find(Current_dir(i,:) > mean_Current_dir(i) + 15 | Current_dir(i,:) < mean_Current_dir(i) - 15);
% end
indind = (Current_dir > mean_Current_dir + 15) | (Current_dir < mean_Current_dir - 15);
% create data and remove values above and below threshold
Current_dir_cor = Current_dir;
Current_dir_cor(indind) = NaN;
scatter(1:numel(Current_dir),Current_dir); hold on
scatter(1:numel(Current_dir),Current_dir_cor,'*');
yline(mean_Current_dir);
yline(mean_Current_dir+15);
yline(mean_Current_dir-15);
0 comentarios
Ver también
Categorías
Más información sobre Visualize Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!