フィルターのクリア

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 Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by