필터 지우기
필터 지우기

Convert x axis to seconds

조회 수: 6 (최근 30일)
Nina Perf
Nina Perf 2021년 11월 22일
댓글: Voss 2021년 11월 24일
Hi,
I need help converting the last 2 plots (plot 2 and plot 3) x axis, to the time domain in seconds, given a data signal with a specific fs.
fs =20;
windowsize = 30; % window size of 50 samples
len = length(data)
nwindow = floor(windowsize)
[min_t, min_o] = min(data_rms);
figure;
% plot 1
plot(1/fs:1/fs:length(data)/fs, data); % this works: Time(seconds)
hold on;
% plot 2, data rms
plot(([1:nwindow]-1)*windowsize, data_rms, 'k*'); % help
% plot 3, min data rms
plot((min_o-1)*windowsize, min_t, 'ro'); % help
hold off
Thank you in advance!

답변 (1개)

Voss
Voss 2021년 11월 23일
If you do the following, does it look right?
% plot 2, data rms
plot(([1:nwindow]-1)/fs, data_rms, 'k*');
% plot 3, min data rms
plot((min_o-1)/fs, min_t, 'ro');
  댓글 수: 2
Nina Perf
Nina Perf 2021년 11월 24일
편집: Nina Perf 2021년 11월 24일
No. It didn't work. Do you have any other suggestions?
Voss
Voss 2021년 11월 24일
What's wrong with it? Maybe post a screenshot or two.

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

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by