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

조회 수: 1 (최근 30일)
julius bruns
julius bruns 2023년 3월 17일
댓글: julius bruns 2023년 3월 20일
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
  댓글 수: 1
julius bruns
julius bruns 2023년 3월 20일
Hi Paul, exactly what I was looking for. Thank you for your solution!

댓글을 달려면 로그인하십시오.

카테고리

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