Im not sure, but it seems to me that the plot you are trying to duplicate marks local minima/maxima points as the absolute minimum/maximum values in each dataset, and not using some more complecated peak analysis.
In that case you can easilly find the deeps and peaks using
rad1 = sin(x).^2 .* tan(x);
[localMinValueRad1, localMinIdxRad1] = min(rad1);
[localMaxValueRad1, localMaxIdxRad1] = max(rad1);
plot([localMinIdxRad1(:); localMaxIdxRad1(:)], [localMinValueRad1(:); localMaxValueRad1(:)], 'rx');