Time Scaling In Discrete Time Signals
45 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Setsuna Yuuki.
le 13 Nov 2020
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 commentaires
Foysal Ahmmed
le 9 Juil 2021
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
le 10 Mar 2023
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
le 18 Mai 2024
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 commentaires
Voir également
Catégories
En savoir plus sur Multirate Signal Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!