Is it by trial and error until the color of plant is like the one you provided?
Yes, that would be a good way to do it. What the camera is pointed at when you move the slider might be irrelevant unless you get a live preview.
Could you tell me how to improve that?
Set the white balance so the brightness of the blue channel is exaggerated.
Could you please explain it more to me?
When a photo (or part of a photo) is well exposed, the values for each pixel (DNs) of areas in the scene of interest (plants) will be on either side of the center of the range (0-255). For example blue (NIR) might be 210 and red (VIS) might be 70. If the photo is underexposed, those same pixels might have values of 150 and 10. In both cases, the difference between NIR and VIS is the same (140), but NDVI computed with those values will differ (0.5 vs. 0.875). NIR (210) is three times VIS (70) when the exposure is good, but NIR (150) is 15 times VIS (10) when the plants in the photo are underexposed. Overexposed plants also produce unreliable results.
Every pixel in the photo must be illuminated the same and exposed the same in order for the computed value of NDVI to be comparable among pixels in the same photo. Bright cloudy days might be the only time this is possible. The sun at your back will always help. Comparing NDVI values between two photos is rarely reliable because sun angle, sky color, exposure, etc., will differ among photos.
Your outdoor photo has areas where plants are in the sun and areas where plants are in the shade. Those plants could have identical "health" but dramatically different "NDVI" values.
How can I use your colormap in MATLAB?
I have not used MATLAB for this but others have: https://publiclab.org/search?q=matlab