I have a PV array at the output terminal of which I have connected a Controlled voltage source. The controlled voltage source has been used instead of a variable resistor (in practical testing of PV module) to provide a range of voltage starting from zero to the open circuit voltage so that I will be able to plot the V-I and P-V characteristics. Now to use MPPT algorithm I need Vpv and Ipv which I provide from the output of the PV module to a MATLAB function block inside which I have written the codes of P&O algorithm. Now as I understand I should get the voltage corresponding to Maximum Power Point which a constant value. However, I got something else which I did't expect.So someone please help me out here to get the necessary curve. Please suggest some rectification in my MATLAB codes for MPPT. I am sharing my simulink model as well as the .m file .