Execution Timing Differences?
显示 更早的评论
[MOVED THE Q? to BODY ... DPB]
If I run this code 10 time each time I got different execution time. I want it to take same time on every run. Also by changing fs from 100K to 1K execution time is of same order. Why it is not reducing for less samples? Please help.
clc; clear all; close all;
tic
fs=100000;
t=0:1/fs:0.1;
carrier=sin(2*pi*300*t);
messSign=sin(2*pi*10*t);
modulatedSig=carrier.*messSign;
y=hilbert(modulatedSig);
envelop=sqrt((real(y).^2)+imag(y).^2);
Diff=(max(envelop)-min(envelop))/5;
[peks,locs]=findpeaks(envelop,'MINPEAKHEIGHT',Diff,'MINPEAKDISTANCE',10,'THRESHOLD',0.05);
%figure;plot(envelop)
toc
1 个评论
dpb
2020-5-20
Timing granularity is probably the biggest culprit plus there's no control of when/what the OS does on task scheduling w/o a realtime OS.
The sizes here simply aren't large enough that they're the limiting factor...try additional multiples of the length--when you get to the point of cache size you'll probably see quantum jump. Whether you can catch the gradual over the number of floating pt operations would take doing lots of averaging I'd guess.
Of what significance is it, anyway?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Quantum Mechanics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!