Hi,
I have a large array H = 70000×1 where I need to calculate the quantity, EH = max( H(t) – min(H(t') ), where the maximum is evaluated over all t and t'>=t. My code is:
EH = zeros(length(H),1); for i = 1:length(H) EH(i)= H(i)-min(H(i:length(H))); end EH = max(EH);
The calculation is slow, around 5-6 seconds. How do I increase the speed off this calculation?
Best regards, Kenneth
Best Answer