Filter löschen
Filter löschen

In the operation of filtfilt, does the filtering process occur in the row direction or the column direction?

2 Ansichten (letzte 30 Tage)
I have a question regarding the direction in which filtfilt operates. Time series data is stored for each column, such as in data.mat. I am considering filtering this data separately for each column. My question has two parts:
  • In the operation of filtfilt, does the filtering process occur in the row direction or the column direction?
  • If it operates in the row direction, is there a way to make it operate in the column direction?
I appreciate your response.
load data.mat
sampling_rate = 200;
cutoff_frequency = 12;
filter_order = 4;
[b, a] = butter(filter_order, cutoff_frequency / (0.5.*sampling_rate), 'low');
filt_data = [data(:,1:2) filtfilt(b, a, data(:,3:end))]
filt_data = 1049×155
1.0e+03 * 0.0010 0 -0.3698 1.2958 0.1429 -0.3810 1.2850 -0.1730 -0.3066 0.8857 0.1010 -0.2512 0.8425 0.0766 -0.3297 0.7808 0.1221 -0.2978 0.8054 0.1134 -0.3281 0.6877 0.1396 -0.3339 0.5977 0.1380 -0.3439 0.5118 0.1294 -0.2394 0.0020 0.0000 -0.3700 1.2958 0.1429 -0.3811 1.2850 -0.1731 -0.3066 0.8856 0.1010 -0.2512 0.8425 0.0766 -0.3297 0.7808 0.1221 -0.2978 0.8054 0.1134 -0.3280 0.6877 0.1397 -0.3339 0.5977 0.1380 -0.3438 0.5118 0.1295 -0.2394 0.0030 0.0000 -0.3701 1.2959 0.1429 -0.3812 1.2851 -0.1731 -0.3067 0.8856 0.1009 -0.2511 0.8425 0.0766 -0.3297 0.7808 0.1221 -0.2978 0.8054 0.1135 -0.3278 0.6878 0.1397 -0.3339 0.5977 0.1380 -0.3437 0.5118 0.1295 -0.2394 0.0040 0.0000 -0.3702 1.2959 0.1429 -0.3814 1.2851 -0.1732 -0.3067 0.8856 0.1008 -0.2511 0.8425 0.0766 -0.3297 0.7808 0.1221 -0.2978 0.8054 0.1135 -0.3277 0.6878 0.1397 -0.3339 0.5977 0.1380 -0.3436 0.5117 0.1295 -0.2393 0.0050 0.0000 -0.3703 1.2959 0.1429 -0.3815 1.2851 -0.1732 -0.3068 0.8856 0.1008 -0.2511 0.8425 0.0766 -0.3296 0.7808 0.1221 -0.2977 0.8054 0.1135 -0.3276 0.6878 0.1397 -0.3338 0.5978 0.1380 -0.3436 0.5117 0.1296 -0.2393 0.0060 0.0000 -0.3704 1.2959 0.1429 -0.3816 1.2851 -0.1733 -0.3069 0.8856 0.1008 -0.2511 0.8425 0.0766 -0.3296 0.7808 0.1221 -0.2977 0.8054 0.1135 -0.3275 0.6879 0.1398 -0.3338 0.5978 0.1380 -0.3435 0.5117 0.1297 -0.2393 0.0070 0.0000 -0.3705 1.2959 0.1428 -0.3817 1.2852 -0.1734 -0.3069 0.8856 0.1007 -0.2511 0.8425 0.0766 -0.3296 0.7808 0.1221 -0.2977 0.8054 0.1135 -0.3274 0.6879 0.1398 -0.3338 0.5978 0.1380 -0.3434 0.5117 0.1297 -0.2393 0.0080 0.0000 -0.3706 1.2959 0.1428 -0.3818 1.2852 -0.1734 -0.3070 0.8856 0.1007 -0.2511 0.8425 0.0766 -0.3296 0.7808 0.1221 -0.2977 0.8054 0.1135 -0.3273 0.6879 0.1398 -0.3337 0.5978 0.1380 -0.3434 0.5117 0.1298 -0.2392 0.0090 0.0000 -0.3706 1.2959 0.1427 -0.3819 1.2853 -0.1735 -0.3071 0.8856 0.1007 -0.2511 0.8425 0.0766 -0.3296 0.7808 0.1221 -0.2977 0.8054 0.1135 -0.3273 0.6879 0.1398 -0.3337 0.5978 0.1380 -0.3433 0.5117 0.1298 -0.2392 0.0100 0.0000 -0.3707 1.2959 0.1427 -0.3820 1.2853 -0.1735 -0.3072 0.8856 0.1007 -0.2512 0.8425 0.0765 -0.3296 0.7808 0.1221 -0.2978 0.8054 0.1135 -0.3272 0.6880 0.1398 -0.3336 0.5978 0.1380 -0.3433 0.5117 0.1298 -0.2392

Akzeptierte Antwort

the cyclist
the cyclist am 16 Aug. 2023
Bearbeitet: the cyclist am 16 Aug. 2023
Per the documentation page filtfilt ...
"The function operates along the first array dimension of x unless x is a row vector. If x is a row vector, then the function operates along the second dimension."
"First array dimension" means down the columns.
  2 Kommentare
Walter Roberson
Walter Roberson am 16 Aug. 2023
And there is no option to filter along rows when the data is not a row vector. If you need to do that, then transpose, .' or permute before filtfilt and convert back afterwards.
Sho
Sho am 16 Aug. 2023
Thank you so much for your help on my MATLAB question. Your response helped me solve my problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by