Combining two wave generation formulas does not work as expected (MATLAB/OCTAVE)
OK, got this solved by @omersayli (dsprelated).
I had put the variable t to a wrong location in both (triangle and square wave) formulas. Here's the correct formula for calculation of saw:
saw = -(2.*m.*asin((s-1)*cos((pi*f0*t)/w)).*acot(s.*csc((pi*f0*t)/w)))./pi^2.-sign(m).+m./2;