Serial.print becomes a blocking function when the transmit buffer is full, the function does not return until there is space in the buffer for what is being printed. You can increase the Serial baud rate, or print fewer characters.
What type of arduino are you using? what baud rate are you using?
On many Arduinos, Print has a 64 byte buffer and when it’s full the call to print() becomes blocking until enough bytes are available to save the whole message to the output buffer. So basically if the rest of the code runs super fast, the throttling factor is proportional to your baud rate.
Remember that the UNO has no floating point hardware. It is all done in software. Eight bits at a time. This could take significant time for a lot of floating point use.
One hypothesis : In the other code (the one not printing) if you were not doing anything with the calculated value then it’s possible that the optimizer got simply rid of all the math and the filtered value altogether. Once you started printing it, the compiler could not throw that code away and suddenly you started paying the right cost for the floating point operations,
the map() function can help you bring yn within 0 255. it won't be perfect but will give you a proxy of what was calculated. PWM being generated in hardware, you would not take a toll like you have with Serial
Assuming yn is in interval [0, maxYN] then you could do
int pwmValue = map(yn, 0, maxYN, 0, 255);
analogWrite(3, pwmValue); // D3 is a PWM pin on UNO
if you add a small RC circuit on D3, you could even generate some sort of "stable" voltage from the PWM or your scope can probably extract information