How do I turn a periodic square wave into aperiodic square wave?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello, I am trying to figure out how to change mt periodic square wave, into a signal pulse so I am able to plot it. This is what I have so far, but my attempts to change it into a single pulse have not been successful. Any help would be greatly appriecated.
function sig_pulse (f,W,C)
if nargin < 3 C = 10; end
if nargin < 2 W = 20; end
if nargin < 1 f = 1e3; end
fs = f*W*2; %create sampling freq
N = fs/W; %create the number of samples
t = [0:N-1]*1/fs;
final = square(f*t);
subplot(2,2,1);
plot(t,y1);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1277085/image.png)
댓글 수: 0
답변 (2개)
Image Analyst
2023년 1월 28일
What did you pass in for f, W, and C?
After you create your pulse train with uniform width pulses, you might call repelem with random numbers to make each pulse a different width.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!