How to generate a discrete square pulse, lets say N times?

조회 수: 5 (최근 30일)
Prajan Pradhan
Prajan Pradhan 2014년 9월 21일
댓글: Naga Sai 2017년 5월 22일
Lets say sample rate =20kHz symbol rate =1khz
  댓글 수: 1
Naga Sai
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
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
Naga Sai
Naga Sai 2017년 5월 22일
sir how to generate a power spectrum for this Wave form
Naga Sai
Naga Sai 2017년 5월 22일
Sir how to generate a power spectrum for this wave form

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


Youssef  Khmou
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
Prajan Pradhan
Prajan Pradhan 2014년 9월 21일
You are using square function to generate square wave, what i want is square pulse in discrete form. I am confused using pulstran @rectpuls as it generates continuous rectangular pulses
Image Analyst
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!

Translated by