clc
clear
strr = [pwd,'\*.m'];
namelist = dir(strr);
len = length(namelist);
if exist([pwd,'ewfile\'])~=0
rmdir([pwd,'ewfile\'],'s') %创建新文件所在的文件夹
end
if exist([pwd,'ewfile\'])==0
mkdir([pwd,'ewfile\']) %创建新文件所在的文件夹
end
newpath = [pwd,'ewfile\'];
fid=fopen([newpath,'newtxt.txt'],'w');
for i = 1:len
file_name{i}=namelist(i).name;
fpn= fileread(file_name{i}); %打开文档
cc = [newpath,file_name{i}];
fprintf(fid,'%s',fpn);
end
fclose(fid);
clear
clc
close all
addpath(genpath(pwd)); %添加文件夹及子文件
warning off
t = 0:0.001:2;
load s.mat s %保存 s 信号
%% SSA 奇异谱分析
K = 6 ;
[~,u]=SSA(s,K);
% Calculate Singular Spectrum Analysis (SSA)
% X: time series
% K: window length = embedding dimension
a = size(u,2);
figure;
imfn=u';
subplot(a+1,1,1);