Binärsignal transformation 100 [Hz] --> 2000 [Hz]

1 次查看(过去 30 天)
Hello Community, I would like to talk to you with a simple problem which I unfortunately just can not solve. The basis is a binary signal with a frequency of 100 Hz. I would like to transform this signal to 2000 Hz. For example, the first value of my input signal has the value 1 --> the first 20 lines of my output signal have the value 1. The second value of my output signal has the value 0 --> lines 20 to 40 of the output have the value 0. My approach over 2 research loops, one with the values 1 to the length of the input value and a subordinate fo loop mi den values 1 to translation factor (output/input) unfortunately does not work. Thank you for your help! I look forward to hearing from you!
Eingangsfrequenz = 100;
Ausgangsfrequenz = 2000;
Eingang = SBO100HZ;
Berechnungsfaktor = (Ausgangsfrequenz/Eingangsfrequenz);
EA = 0;
BF = 0;
Ausgang = (zeros(1,length(Eingang)*Berechnungsfaktor))';
for EA = 1:length(Eingang)
for BF = 1:Berechnungsfaktor
Ausgang((1*EA)+BF-1,1) = Eingang(EA);
end
end

回答(1 个)

Paul
Paul 2023-3-19
Hi julius,
Does repelem meet the requirement. Here's a small example to repeat each element three times (instead of 20) to make it easy to see
x = [1 0 1 0];
repelem(x,3)
ans = 1×12
1 1 1 0 0 0 1 1 1 0 0 0

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by