Problem solved !
The error was in the following loop:
count = 1;
for t = 0.0001:1/(50*fs):0.0003
y1(count) = subs(yn1);
y2(count) = subs(yn2);
count = count+1;
Instead of the above loop, the code should be like :
t = 0.0001:1/(50*fs):0.0003
y1 = subs(yn1);
y2 = subs(yn2);
The exact reason behind the code is not known to me.
Hope any MATLAB expert helps in this matter.