フィルターのクリア

Time Scaling In Discrete Time Signals

45 ビュー (過去 30 日間)
enrique128
enrique128 2020 年 11 月 13 日
回答済み: tuan 2024 年 5 月 18 日
Hello everyone. I want to apply time scaling property to my signal. It is hard for me to apply for the signals especially like x[4n], x[2n], x[1/3n]. I know there must be mod calculation because the values should be integer but i could not write the code can someone help me please?
n=[-2 -1 0 1 2 3 4];
x=[3 1 0 4 6 2 9];

回答 (2 件)

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 13 日
n=[-2 -1 0 1 2 3 4];
x=[3 1 0 4 6 2 9];
stem(n,x);hold on; %original
n2 = 4*n;
stem(n2,x); %x4
n3 = 2*n;
stem(n3,x);%x2
to x[1/3n] I don't know :(
  3 件のコメント
Foysal Ahmmed
Foysal Ahmmed 2021 年 7 月 9 日
okey. but the figure should include 0 amplitude for the rest of the integer sample value. Again we cant find x[n/2] this way. because they includes fraction sample n=1.5 .
Luke Ramel
Luke Ramel 2023 年 3 月 10 日
this is wrong, since if we have a multiplier of 2 to the time (n) the x-axis values should be divided by 2 since we are scaling time.

サインインしてコメントする。


tuan
tuan 2024 年 5 月 18 日
x = [3 1 0 4 6 2 9];
n=-2:4
% Time scaling factors
factors = 2; % efficiency
for factor = factors
% Determine scaling type (compression or expansion)
if factor > 1
scaling_type = 'Compression';
else
scaling_type = 'Expansion';
end
% Time-scaled indices based on scaling type
if factor > 1
% Compression: select indices where n is a multiple of factor
indices = find(mod(n, factor) == 0);
n_scaled = n(indices);
x_scaled = x(indices);
else
% Expansion: replicate and interpolate for integer multiples of factor/n
n_scaled = n / factor;
x_scaled = zeros(size(n));
for i = 1:length(n_scaled)
% Find the closest integer in n for the current n_scaled(i)
[~, closest_idx] = min(abs(n - n_scaled(i)));
x_scaled(i) = x(closest_idx);
end
end
% Plot original and time-scaled signals
figure(1)
stem(n, x);
title('Original')
xlabel('n');
ylabel('Amplitude');
axis([-5,5,0,10])
figure(2)
stem(n_scaled, x_scaled);
xlabel('n');
ylabel('Amplitude');
title('Time Scaling of Discrete-Time Signal');
axis([-5,5,0,10])
end

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by