Hi All
I have a time array , from which I first drop some elements, then change its frequency based on the input I give. the array is X in the code. what happens is that for some specific values , like reduction = 2 and freq = 1000 Hz if the original frequency of X was 512 Hz, the length of redt2 falls one element shorter than the original X array. how does this happen and what is the solution.
X is any time signal, 1D array with any length and frequency
reduction =2
X =X (1:reduction:numel(X));
redt1=[X];
rf= redt1(2)-redt1(1);
tend=redt1(numel(redt1));
freq= input(frequency)
dt= 1/freq
redt2= 0:dt:tend/rf/freq;
8 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166633
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166633
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166683
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166683
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166688
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166688
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166703
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166703
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166708
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166708
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166758
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166758
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166888
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1166888
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1167258
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/665713-changing-the-frequency-of-an-array-does-not-work-always#comment_1167258
Sign in to comment.