필터 지우기
필터 지우기

How to input two values as one value

조회 수: 2 (최근 30일)
Anthony Koning
Anthony Koning 2023년 4월 27일
댓글: KSSV 2023년 4월 27일
Hi, I'm wondering how two different values can be combined into one individual value. For example, I have a signal Y with 10000 samples, with 100 samples equalling to 1 second. If I were trying to plot Y in terms of seconds, that is rather easy to do by using a code
samples = length(Y);
fs = 100;
time = 0:1/fs:samples/fs-1/fs;
and then simply plotting plot(time, Y). However, If I wanted to do something like plotting the power spectrum density of the signal using pwelch but only for the section between 20 and 40 seconds, how would I code this? Thanks

채택된 답변

KSSV
KSSV 2023년 4월 27일
samples = length(Y);
fs = 100;
time = 0:1/fs:samples/fs-1/fs;
iwant = Y(time>=20 & time<=40)) %<-- this pciks Y for time between 20 and 40 seconds
  댓글 수: 2
Anthony Koning
Anthony Koning 2023년 4월 27일
편집: Anthony Koning 2023년 4월 27일
And in this case, to take the pwelch, you would simply define pwelch(iwant), correct?
KSSV
KSSV 2023년 4월 27일
Yes.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by