Time Scaling In Discrete Time Signals
조회 수: 45 (최근 30일)
이전 댓글 표시
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];
댓글 수: 0
답변 (2개)
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
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
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
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!