I want to calculate active power and reactive power from instantaneous voltage and current.give the algoithm or links sothat it can be implemented in MATLAB program. The voltage and current are having harmonics.
Calculating active and reactive power instantaneously means that you know the phase between voltage and current in real time. To do so there are many solutions. In my opinion, the easiest one is to have a PLL system for your voltage and current in order to know where you are on the signal and then perform your calculation.
Simulink already has this algorithm in block diagram. Another way is to find the rms values of all instantaneous voltages and currents and then use these. As Adrien notes you will have to start simulation at zero crossing of one phase. Check Simulink as it already has these libraries which you may call from MATLAB.
Simulink models: https://www.mathworks.com/matlabcentral/fileexchange/33952-active-power---reactive-power---power-factor-measurement-in-three-phase-system (not sure of this !!)