Execution Timing Differences?
Show older comments
[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 Comment
dpb
on 20 May 2020
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?
Answers (0)
Categories
Find more on Quantum Mechanics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!