nano second
5 次查看(过去 30 天)
显示 更早的评论
I am still confused about the access time on the order of nano second.how matlab can have accurate time in order of nano second.
0 个评论
采纳的回答
Jan
2011-4-13
Even microseconds are not valid in Matlab, if you measure them using CLOCK or CPUTIME: See CSSM: Precision of CLOCK and CPUTIME.
The 1000th parts of the seconds between subsequent calls of CPUTTIME and CLOCK are correlated:
function sillyTest
a = cputime;
v = rand(1000); % Any operation wasting some time
% drawnow; % Waste more time
b = cputime;
fprintf('%f %.3f\n%f %f.3\n', a, rem(a*100, 1), b, rem(b*100, 1);
While the 10th and 100th parts of the seconds are independent, the 1000th parts are monotonically increasing (execpt for overflow) - at least in Matlab 2009a. The same problem appears for CLOCK.
2 个评论
Walter Roberson
2011-4-19
The document you refer to shows that there is a format ("cdfepoch") which is able to represent date/times as milliseconds since 01-Jan-0000 . That requires, though, that you have some way of measuring time to millisecond accuracy, which is not possible in MATLAB without hardware assistance or use of operating-system-specific facilities. And unfortunately the indeterminacy of timing in accessing the operating-system-specific facilities from MATLAB is higher than the precision that can be gained by calling upon them.
更多回答(3 个)
Walter Roberson
2011-4-5
Perhaps I need to word this even more strongly:
You cannot do the timing that you are hoping to do within MATLAB itself. MATLAB is not a suitable language for precision timing.
It appears that you are probably thinking of using signals in the UHF band, 300–1000 MHz, especially with your earlier reference to missile detection. There is no built-in MATLAB facility that would allow you to time events accurately enough to use even HF band, 3–30 MHz. The highest resolution you can use within MATLAB itself is 1 KHz.
0 个评论
Pierre
2011-4-5
At first I have to admit that everything I'll state now is pure mostly speculation and I don't have any reliable resources for this.
I don't think the nano second values you gather do reflect anything useful:
At first, I'd like to point out, that if a clock has got a nano second resolution, this does not mean it's got a nano-second accuracy. The clock might be accurate in µs, although it counts 1000 "nano-seconds" during one µs. But one of those tics might last for 1.5 real nano-seconds, another one only 0.5 nano-seconds, statistically, the clock becomes accurate at µs-level.
Second, a Matlab-script being interpreted, running on a virtual machine in a multi-threaded environment will provide you nonsense values even at µs level... the only reliable time-measure which is independent from other stuff running on your machine should be the CPU-time consumed by your script... but I'm not sure you can recover these. (If you can, we agree that a CPU clocked at 10?Hz has CPU-cycles lasting 1/10? s ;) .)
Walter Roberson
2011-4-5
You cannot accurately measure nano-second resolution times in MATLAB itself. You may be able to read nano-second resolution times as data time stamps from an instrument, or if you are using code generated by the Real Time Workshop on a standalone PC target running at 1 GHz or more, you maybe be able to read the hardware cycle counters.
You should completely give up on the idea that now() or clock() or tic() or toc() will be able to provide you with meaningful nano-second-level information.
4 个评论
Walter Roberson
2011-4-19
Millisecond is the highest resolution that one can expect using the standard MATLAB facilities such as clock() . What can be obtained on a stand-alone system using one of the Target Support packages is a different question and I don't know the answer to that. If you pick a *particular* board and *particular* Analog To Digital convertor (ADC) then I can google the specifications, but I am not going to spend my time researching all the available ADC for all 8 of the supported board families.
My recommendation would be that you find an ADC that does time-stamping *at the ADC*, and then the question merely becomes one of whether a reasonable system can handle the data transfer rate you would like to use.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!