Hi Hyung,
The `spectrum` and `pwelch` functions both calculate the power spectral density of a signal. However, the `pwelch` function explicitly detrends the data by subtracting the best-fit straight line using the `detrend` function. This detrending process can lead to differences in the calculated spectral density.
The issue can be resolved by using the ‘detrend’ function in both the case to avoid the mismatch occurring at the lower frequencies.
When using a logarithmic scale, large values are compressed while small values are expanded. This scaling effect makes any mismatch at low frequencies more pronounced on a log scale, whereas it might be negligible on a linear scale.
I hope this helps!