How to generate a discrete square pulse, lets say N times?
4 ビュー (過去 30 日間)
古いコメントを表示
Lets say sample rate =20kHz symbol rate =1khz
1 件のコメント
Naga Sai
2017 年 5 月 22 日
https://in.mathworks.com/matlabcentral/answers/155687-how-to-generate-a-discrete-square-pulse-lets-say-n-times#comment_238487
回答 (2 件)
Image Analyst
2014 年 9 月 21 日
Make up one cycle, then use repmat() to make as many copies as you want.
squareWave = repmat([1,1,1,1,0,0,0,0], [1, N]);
What is a "symbol rate"?
10 件のコメント
Youssef Khmou
2014 年 9 月 21 日
You can either write the function or use built-in function, here is an example using 1000 samples :
N=1e+3;
Fs=20e+3;
f=1e+3;
Ts=1./Fs;
t=0:Ts:N*Ts-Ts;
y=square(2*pi*f*t);
figure; plot(t,y);
2 件のコメント
Image Analyst
2014 年 9 月 21 日
Yes, square() is in the Signal Processing Toolbox - do you have that toolbox? I have not heard of those two other functions you mention.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

