필터 지우기
필터 지우기

How to shift the graph?

조회 수: 3 (최근 30일)
Jaya Sodhani
Jaya Sodhani 2022년 6월 27일
답변: Star Strider 2022년 6월 27일
y=audioread('speech.wav');
subplot(2,3,1);
plot(y);
xlabel('Samples');
ylabel('Magnitude');
title('Original speech signal');
%Dividing the signal into frames
f_duration = 0.025;
fs=8000;
f_size = (f_duration.*fs);
n = length(y);
n_f = floor(n/f_size); %no. of frames
temp = 0;
for i = 1 : n_f
frames(i,:) = y(temp + 1 : temp + f_size);
temp = temp + f_size;
end
Now I want to plot only frame 1 and frame 2 in such a way that when frame 1 ends after that only frame 2 starts. For this I need to shift the x-axis by f_size. But i am unable to do so.
Please help me.

답변 (2개)

KSSV
KSSV 2022년 6월 27일
Read about montage

Star Strider
Star Strider 2022년 6월 27일
It is easier to use the buffer function for this —
t = linspace(0, 250, 5000);
s = exp(-0.01*t) .* sin(2*pi*t*700);
figure
plot(t, s)
xlabel('Time')
ylabel('Amplitude')
title ('Original Signal')
Tbuf = buffer(t, 500);
Sbuf = buffer(s, 500);
NrSubplots = size(Tbuf,2);
spcol = 2;
sprow = floor(NrSubplots/spcol);
ylimv = [min(s) max(s)];
for k = 1:NrSubplots
subplot(sprow,spcol,k)
plot(Tbuf(:,k), Sbuf(:,k))
grid
xlim([min(Tbuf(:,k)), max(Tbuf(:,k))])
ylim(ylimv*1.1)
xlabel('Time')
ylabel('Amplitude')
title(sprintf('Segment #%2d: t = %.2f to %.2f', k, min(Tbuf(:,k)), max(Tbuf(:,k))))
end
.

카테고리

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

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by