Hello everyone again!
I realized all of my mistakes in previos algorithm, and wrote correct version of all metioned above functions using Welch algorithm: Power Spectral Density Estimation, Cross Power Spectral Density Estimation, Coherence between two signals.
I offer for your attention program, which you can find all these functions as procedures.
I attached program which results obtained with my Maple programm and Matlab built-in functions (pwelch, cpsd, mscohere) are compared. So, 5 attached files: Maple_programm, input signals for Matlab and Maple, power spectral density from matlab for signal1, cross power spectral density from matlab, coherence from matlab.