How we can give Delay in a clock ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi. I am using "Delayseq" function in MATLAB function block using simulink. But it doesn't provide delay in a clock. I cannot use ideal fixed unit delay block because, I need variable delay and later I have to adjust that delay. therefore, I am using this customized function. but it's not giving delay in a clock.
shifted_signal = delayseq(u,0.004,250);
here, I am giving delay 4ms and sampling frequency is 250. I set 250 because in clock generation block I set sampling time =4ms.
I attached the snaps please have a look and help in this regard. I really need help for this work. if anyone help it would be appreciated. Thanks
채택된 답변
Honglei Chen
2018년 11월 5일
delayseq works on a vector, e,g.,
>> delayseq([1;0;1;0;1;0;1;0;1;0],0.004,250)
>> ans =
0
1
0
1
0
1
0
1
0
1
while if I under your model correctly, the pulse samples are generated one at a time, that's why the function is not providing the correct answer. You can consider adding a buffer in between to convert the signal to vector, but then you need to live with the fact that there is a latency due to the buffering at the output.
HTH
댓글 수: 13
Sarfaraz Ahmed
2018년 11월 6일
편집: Sarfaraz Ahmed
2018년 11월 6일
Thank you Chen for your valuable answer. I added buffere in order to convert signal into vector but it gain showing the same. That's the same buffer which you were talking about ?
could you please have a look into attached file ? Thanks you.
Honglei Chen
2018년 11월 6일
How did you setup the buffer? And would it be possible to share the model?
Sarfaraz Ahmed
2018년 11월 6일
편집: Honglei Chen
2018년 11월 8일
Thanks Mr.Chen, I setup just by adding buffer block between clock and delay function. I attached my model and other snap. if the model file doesn't open please let me know. inside function block the code is :
function y = sample(u)
shifted_signal = delayseq(u,0.002,500);
y=shifted_signal;
Please help me how I can add proper buffer ? so that delayseq work properly.
it would be really appreciated. Thanks
Sarfaraz Ahmed
2018년 11월 8일
Hi. Sir could you please help me in the buffer design ? Thanks
In your model, if you set the overlay in Buffer to 1, you should be able to see the correctly shifted sequence.
If you want to further remove the extra line, you can change your code slightly by doing
y = shifted_signal(2);
HTH
Sarfaraz Ahmed
2018년 11월 8일
Thanks sir. But if i changes the delay from 0.002 to 0.003 it should produce 1ms more delay instead it's giving straight line at 0. why it's happening ? delay should be flexible but I don't know how to fix this issue. could you please help me here ?
function y = sample(u)
shifted_signal = delayseq(u,0.003,500);
y=shifted_signal(2);
please see an attachment. Thanks
Honglei Chen
2018년 11월 8일
This is because if you only buffer two samples, then you don't get anything in the output since the delay is more than what can be accommodated in two samples. You certainly need to adjust parameters but in addition you probably won't get a clean signal since your delay includes a half-sample and in theory this is not well defined.
HTH
Sarfaraz Ahmed
2018년 11월 9일
편집: Sarfaraz Ahmed
2018년 11월 9일
Thanks Sir. I understand but I am worried how parameter can be set ? what factor/parameter needs these setting ? ok, let say I don't give much delay I just give 3us delay then how parameter setting can be defined ? Actually, I have to give some delay and later this delay control by another signal in 2,3 steps automatically not manually.
for ex, if I give delay 3us then it will reduce to zero by external signal in 3 steps. could you please help in that scenario ?
%3us delay
function y = sample(u)
shifted_signal = delayseq(u,0.000003,500);
y=shifted_signal(2);
%sampling time of clock =0.002
Thanks
Honglei Chen
2018년 11월 20일
Sorry I missed this.
I think an important issue here is you chose the source block which outputs one sample a time but delayseq() really likes to work with a vector. Thus the mismatch and the need for the buffer. I would suggest if possible to provide a vector as input then the processing becomes easier and you can specify the parameter more freely as long as the delay is not longer than the duration of the signal vector.
HTH
Sarfaraz Ahmed
2018년 11월 21일
Thanks Chen.
yes, I understand but How can I pass vector clock as a source block ? This become a problem here.
Thanks
Honglei Chen
2018년 11월 21일
If it's just a pulse, you can try the Rectangular Waveform block from Phased Array System Toolbox.
Sarfaraz Ahmed
2018년 11월 22일
편집: Sarfaraz Ahmed
2018년 11월 22일
Thanks Chen, I will try this . Let see if it works in my aplication.
Thanks for such kind of supporting.
ritu rai
2019년 2월 16일
hi,
I am facing the same problem. I want to provide variable time delay to a sawtooth signal using matlab function block. Please help in this regard.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Sources에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
