ssa
1function newpw = TrendSubtraction(pw)
2smoot_pw = smoothdata(pw,"movmean",32);
3% smooth_pw = smooth(pw,128);
4newpw=pw-smoot_pw;
5
6figure();
7subplot(2,1,1);
8plot(pw); hold on; plot(smoot_pw); grid on; hold off;
9legend('pw','smoothdata');
10% plot(pw); hold on; plot(smoot_pw); grid on; plot(smooth_pw); hold off;
11% legend('pw','smoothdata','smooth');
12
13subplot(2,1,2);
14plot(newpw); grid on;
15
16end