I have a function which in total takes 34s and I want to speed this up. The 2 slowest functions are:
1) I have a very simple function file:
function [x] = percentChange(startPoint, currentPoint)
x = ( (currentPoint-startPoint)/abs(startPoint) )*100.00;
where currentPoint and startPoint are just integers. During my main function I call this function 1.114.239 times (which takes my computer 13.364s). Can I make this any faster?
2) Another part of my function which takes quite a while is the plotting of 1934 lines. Currently, the plotting is done as follows:
for i=1:size(patternPlot,1)
hold all
plot(xplot,patternPlot(i,:));
end
'patternPlot' stores the vectors i want to plot (xplot is just the vector 1:30). Can I speed this up in any way?
Thanks in advance,
J