@John D'Errico,
If you read my comment, I clearly said, I need guidance on how to approach this sort of coding in MATLAB, nothing more. I am absolutely NOT in need of someone solving it as I will be dealing frequently with such expressions. If you can refer to some material, which if studied can help me with this, fine else ignore the question then