Problem with matrix as input for pwelch()

조회 수: 4 (최근 30일)
Jan Pastyka
Jan Pastyka 2016년 2월 13일
댓글: Jan Pastyka 2016년 2월 17일
I am trying to use pwelch fuction, but when I put in data in matrix (columns are independent parts of signal). pwelch returns PSD only for first column (vector), but I expected matrix with PSD in columns for every culomn. What I do wrong? My code is:
x; % data in matrix
w = pwelch(x); % w is vector with PSD of first column of x

답변 (2개)

Image Analyst
Image Analyst 2016년 2월 13일
Strange. Run this code and then paste the results in the command window back here:
clc;
x = rand(1000, 10);
whos x
spectra = pwelch(x);
whos spectra
message = sprintf('pwelch(data) returned %d spectra', size(spectra, 2))
uiwait(helpdlg(message));
What do you observe?
  댓글 수: 2
Image Analyst
Image Analyst 2016년 2월 14일
Jan's response to me moved here because it's not an answer to her original question at the top:
My result:
Name Size Bytes Class Attributes
x 1000x10 80000 double
Name Size Bytes Class Attributes
spectra 129x1 1032 double
message =
pwelch(data) returned 1 spectra
so I think it still doesn't work. And I use Matlab 2013a if it can have some effect...
Image Analyst
Image Analyst 2016년 2월 14일
Jan, you should get this:
Name Size Bytes Class Attributes
x 1000x10 80000 double
Name Size Bytes Class Attributes
spectra 129x10 10320 double
message =
pwelch(data) returned 10 spectra
You didn't name some other function pwelch(), did you? What does this say
>> which -all pwelch
If it doesn't say this:
C:\Program Files\MATLAB\R2015b\toolbox\signal\signal\pwelch.m
and lists two files instead, then you'll have to get rid of the other file or rename it. If it does say that, then call the Mathworks to help you investigate it further.

댓글을 달려면 로그인하십시오.


Honglei Chen
Honglei Chen 2016년 2월 16일
Hi Jan, can you run
which pwelch
and see if you are indeed running the correct pwelch? Also it will be helpful if you could share which release your MATLAB is.
  댓글 수: 1
Jan Pastyka
Jan Pastyka 2016년 2월 17일
Reinstallation of Matlab solved the problem.

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by