本人也是初学者哈,我觉得可能是你的数据本来就没有对吧.但是我这有个程序可以画出来我给的数据信息.
A=2; %幅值
fs=100; %采样频率
f_singal=10; %信号频率
t=-1:1/fs:1; %信号步进
x=A*sin(2*pi*f_singal*t); %产生数据
save sinfile.txt x -ASCII
%画图
>> close all;
load sinfile.txt;
fs=100;
N=length(sinfile); %N样点的个数
fx=fft(sinfile);
df=fs/N; %df频率分辨率
n=0:N/2; %
f=n*df; %频率轴上横坐标
subplot(121);
plot(sinfile);
subplot(122);
plot(f,abs(fx(n+1)));
|