%FFT图%%%%%%%%%%%%%%%%%%%%5
Fs = 1/(t(2)-t(1));
N = length(x(:,1));
n = 0:N-1;
y = fft(x(:,1),N);
mag = abs(y);
Fre = n*Fs/N;
figure
plot(Fre(1:N/2),mag(1:N/2));%x的FFT
xlabel('frequency');
ylabel('x amplitude');
y = fft(x(:,3),N);
mag = abs(y);
Fre = n*Fs/N;
figure
plot(Fre(1:N/2),mag(1:N/2));%y的FFT
xlabel('frequency');
ylabel('y amplitude');
y = fft(x(:,5),N);
mag = abs(y);
Fre = n*Fs/N;
figure
plot(Fre(1:N/2),mag(1:N/2));%z的FFT
xlabel('frequency');
ylabel('z amplitude');
y = fft(x(:,7),N);
mag = abs(y);
Fre = n*Fs/N;
figure
plot(Fre(1:N/2),mag(1:N/2));%thetaY的FFT
xlabel('frequency');
ylabel('thetaY amplitude');
y = fft(x(:,9),N);
mag = abs(y);
Fre = n*Fs/N;
figure
plot(Fre(1:N/2),mag(1:N/2));%thetaZ的FFT
xlabel('frequency');
ylabel('thetaZ amplitude');
%相图%%%%%%%%%%%%%%%%%%%%%
figure
plot(x(:,1),x(:,2),'LineWidth',2);%x方向相图
xlabel('x');
ylabel('dx/dt');
figure
plot(x(:,3),x(:,4),'LineWidth',2);%y方向相图
xlabel('y');
ylabel('dy/dt');
figure
plot(x(:,5),x(:,6),'LineWidth',2);%z方向相图
xlabel('z');
ylabel('dz/dt');
figure
plot(x(:,7),x(:,8),'LineWidth',2);%thetaY相图
xlabel('thetaY');
ylabel('dthetaY/dt');
figure
plot(x(:,9),x(:,10),'LineWidth',2);%thetaZ相图
xlabel('thetaZ');
ylabel('dthetaZ/dt');
现在感觉fft和相图还有问题,您能帮助看看吗? |