# Why are MATLAB and matplotlib spectrogram value different?

I'm doing a signal processing to put data into my neural network.

I noticed a difference between MATLAB and Python spectrogram Value. I don't know why and ask questions.

This is MATLAB code

[y, Fs] = audioread('left (1).wav'); %1sec 16000 sample read

nwin  = 256; %16ms
novlp = 128; %8ms
nfft  = 256;

left = spectrogram(y, nwin, novlp, nfft, Fs, 'yaxis');


256-fft_point, 256 hamming window, 50% over lab, 16000 sampling rate

And This is Python code

import numpy as np
import soundfile as sf
from matplotlib import mlab

win = np.hamming(256)
Sxx, f, t = mlab.specgram(x=audio_sample, NFFT=256, Fs=sampling_rate, window=win, noverlap=128, mode='complex',
sides='default', detrend='none')

np.savetxt('C:/Users/HOME/Desktop/left_spec (1).txt', Sxx, delimiter=',')


It is also 256-fft_point, 256 hamming window, 50% over lab, 16000 sampling rate

However, the values are totally different as shown below.

In addition to the first four values, all values show different values.

When I read the wav file, the value seems to be the problem of the spectrogram function because both MATLAB and Python are the same.

I also changed the parameters of Python spectrogram function, tried post-processing such as Sxx = 10 * np.log10 (Sxx), and tried the spectrogram function of the scipy kit, but not all the same values as MATLAB.