You do not show us any source for f1 or f2.
You calculate y1 and y2 as expressions, but you do not use them. You calculate ks but you do not use it.
Your expression for y2 involves the undefined variable "k".
Note: it would probably be better to not redefine "pi" as MATLAB has that built in.
