For vec1, the reason is that the peak is also the last data point and so is intentionally exlcuded. The findpeaks documentation says "Non-Inf signal endpoints are excluded." For vec2, the issue is thresholding. Your threshold is expressed in terms of dt but you haven't mentioned how this is defined. So, I guessed and put
thresh = 0.1*max(vec2)
which gives around 0.0021, reproducing your second plot including the fact that the first peak is not detected.
Let's compare a peak that is detected (at element 39) with the one that is not (at element 11). The peak at element 39 'sticks out more' compared to its neighbours.
fprintf("the 10th element is %f\n",vec2(10))
fprintf("the 11th element is %f\n",vec2(11))
fprintf("the 12th element is %f\n",vec2(12))
fprintf("the 38th element is %f\n",vec2(38))
fprintf("the 39th element is %f\n",vec2(39))
fprintf("the 40th element is %f\n",vec2(40))
gives
the 10th element is 0.016000
the 11th element is 0.018000
the 12th element is 0.016000
the 38th element is 0.015000
the 39th element is 0.018000
the 40th element is 0.015000
The threshold I used was 0.0021. Lowering it a little to 0.0020 unfortunately detects too many peaks
I'm not an expert in how to best use findpeaks but one way of getting what you want is to lower the threshold a little and set a minimum peak height. Like this:
[pks,vec2locs] = findpeaks(vec2, 'MinPeakProminence',thresh,'MinPeakHeight',0.0175);
This gives