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

2 views (last 30 days)
julius bruns
julius bruns on 17 Mar 2023
Commented: julius bruns on 20 Mar 2023
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

Answers (1)

Paul
Paul on 19 Mar 2023
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
  1 Comment
julius bruns
julius bruns on 20 Mar 2023
Hi Paul, exactly what I was looking for. Thank you for your solution!

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!