how can delay give in nano or pico seconds ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Jan
am 8 Jan. 2019
Bearbeitet: Jan
am 8 Jan. 2019
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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Clocks and Timers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!