How can control the phase delay of the signal generated by "Pulse Generator" block externally?

조회 수: 8 (최근 30일)
Hi friends,
I want to generate a square wave by using pulse generator block in simulink where phase delay is coming from an external source. As you know the phase delay of the output signal of this block can be set internally. Is it possible to control the phase delay of this block by a external signal?
Regards Foad

채택된 답변

Niklas Nylén
Niklas Nylén 2014년 2월 7일
편집: Niklas Nylén 2014년 2월 7일
If you have a limited range of number of samples that your signal should be delayed you could build a block for variable delay using a number of unit delays and a multiport switch. I have attached a model which could handle between 0 and 10 samples of delay (although I have not verified it more than that it is simulatable).
  댓글 수: 2
Seyedfoad Taghizadeh
Seyedfoad Taghizadeh 2014년 2월 7일
Thanks a lot for the reply, It would be suitable for my system. However, I do not know how I can use these codes in order to create a delay block. Should I open a Matlab embeded function then I put the codes there? Please guide me,
Thanks
Niklas Nylén
Niklas Nylén 2014년 2월 18일
Put the model I attached as a subsystem after the pulse generator.

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

추가 답변 (2개)

ES
ES 2014년 2월 7일
When the external signal comes, do a
set_param(BlockName,'PhaseDelay',PhaseDelayValue);
  댓글 수: 1
Seyedfoad Taghizadeh
Seyedfoad Taghizadeh 2014년 2월 7일
The external signal comes from a "Matlab Embeded Function" block. Where should I write this command (set_param (BlockName,'PhaseDelay',PhaseDelayValue);)? Do I have to make another "Matlab Embeded Function" block between the first block and the "pulse generator" block and write this code into that? and then I should connect the output of the new "Matlab Embeded Function" block to pulse generator block?
Please make it clearer for me how I should implement it.
Highly appreciated.
Regards Foad

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


Niklas Nylén
Niklas Nylén 2014년 2월 7일
If I understand your question correctly it could probably be solved by placing a "Variable time delay" block after the pulse generator block and connect the external source to that block.
  댓글 수: 1
Seyedfoad Taghizadeh
Seyedfoad Taghizadeh 2014년 2월 7일
Thanks a lot for your reply, Actually, due to I want to compile the file on a DSP(F28335), I have to use discrete-function blocks. According to your suggestion I used "Discrete Variable Time Delay", and I connected the output signal of "pulse generator" block to the input port of this block. In the simulation the signal was shifted properly, but as this block is a non-inlined s-function, my compiler didn`t accept it.
Hence, please let me know how I can use the set_param command to shift the output signal of "pulse generator" block. I think it works.
Highly appreciated for taking your time,
Regards Foad

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by