필터 지우기
필터 지우기

Welch's method implementation

조회 수: 3 (최근 30일)
Tu Nguyen
Tu Nguyen 2022년 4월 3일
답변: Tala 2022년 4월 3일
Hi Dears;
I want to loop through the data 256 points at a time, and 128 points overlap, However, I beleive that my function missing something to perform that because when I run the code, it returns "Unable to perform assignment because the size of the left side is 512-by-1 and the size of the
right side is 256-by-128."
How can I do loop through the data 256 points at a time and 128 points overlap?
I really appreciate for your help
clc;
close all;
clear;
load('ecg_60Hz_Noise_Fs200Hz.mat');
data = ecgn(1:1024)';
Fs = 200;
w = hamming(256);
psd = zeros(512,7);
for i = 0:6
temp = data(1+256*i:128+i*256)'.*w;
temp = fft(temp);
temp = abs(temp).^2;
psd(:,i+1) = temp;
end
psd1 = mean(psd,2);
psd1 = psd(1:257);
psd1 = psd1/(Fs*sum(w.^2));
psd1(2:end-1)= psd1(2:end-1)*2;
figure
plot(f,psd1);

채택된 답변

Tala
Tala 2022년 4월 3일
Instead of the for loop, I would reshape the array first.
temp0 = reshape(ecgn,[256,4]);
temp1=fft(temp0);
temp2=abs(temp1).^2;
psd=temp2;
then the rest of your calculations...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by