Generating Square Wave in Matlab

조회 수: 4 (최근 30일)
Seyedfoad Taghizadeh
Seyedfoad Taghizadeh 2014년 1월 16일
답변: Walter Roberson 2014년 1월 16일
Hi,
I intend to generate a square wave by Matlab simulation with this characteristic:
- 20 kHz, - amplitude between 0 and 1, - it is able to be shifted.
Then, I am going to convert the square wave to a DSP board. Therefore, I have to use discrete time blocks. Because the continues time blocks are not acceptable by compiler.
Please help me to find the appropriate algorithm.
Regards Foad

채택된 답변

Image Analyst
Image Analyst 2014년 1월 16일
How about using ones(), zeros(), and repmat()?
  댓글 수: 3
Seyedfoad Taghizadeh
Seyedfoad Taghizadeh 2014년 1월 16일
Thanks for your reply,
I can not generate square wave by coding and I have to simulate it using blocks. Because Matlab codes can not be converted to DSP board. As I mentioned earlier, the blocks also must be discrete time based blocks. I have already used the "Discrete time PWM" block of Matlab. But it did not work. The compiler recognized this block as a continues time block. Do you have any suggestion in this regard?
Regards Foad
Image Analyst
Image Analyst 2014년 1월 16일
편집: Image Analyst 2014년 1월 16일
I assume you mean Simulink. Sorry - I do not have Simulink. I didn't know Simulink was required because you didn't list that in the Products or Tags. I will put it there for you so other people will know. I thought you could put MATLAB code into blocks but since I don't have it, I'm not sure.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 16일

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by