필터 지우기
필터 지우기

how can delay give in nano or pico seconds ?

조회 수: 6 (최근 30일)
Sarfaraz Ahmed
Sarfaraz Ahmed 2019년 1월 8일
댓글: Sarfaraz Ahmed 2019년 1월 9일
Hi. I am giving delay to clock in mili, nano, pico seconds. Actually the clock timing value is let say 0.02 , if I attach variable transport delay block after the clock with 3m sec then my sampler sample the input at 0.023 which is fine. but when I give delay 3n sec or 3p sec then it makes the value same 0.02 (no affect of delay) or assume that small delay to 0.
Basically, I am working on nano and pico seconds. so it's very impportant to consider even small delay. How can I do this any one can help in this regard please ? I attached the the snap and delay code below:
function y fcn(count)
persistent p;
persistent j;
if isempty(p) % Initialization
p=0.3e-3;
%p=3e-9;
end
if isempty(j) % Initialization
j=-1;
end
step_size=0.1e-3 %% Initialization
%step_size=1e-9 %% Initialization
if(count<=j)
p=p - step_size;
j=j-1;
end
y = p;
Thanks
  댓글 수: 2
Jan
Jan 2019년 1월 8일
편집: Jan 2019년 1월 8일
I do not understand, what your problem is.
x = 0.02 - 1e-9
fprintf('%.16g\n', x)
You see that the results differs from 0.02. Maybe you use disp to show the values? Then increase the number of displayed digits:
format long g
0.02 - 1e-9
This is not a more accurate calculation, but only less rounding for the display in the command window.
Sarfaraz Ahmed
Sarfaraz Ahmed 2019년 1월 9일
Thanks Jan. I will look by setting long format.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Pulse and Transition Metrics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by