请matlab高手帮忙查下错在哪里?急
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/08 07:39:07
请matlab高手帮忙查下错在哪里?急
输入程序如下:
fs=10000;
t=0:1/fs:0.1;%采集信号长度为0.1
A=444.128;a=50*sqrt(2)*pi;b=a;
xa=A*exp(-a*t).*sin(b*t);
k=0:511;f=fs*k/512;
Xa=fft(xa);%近似模拟信号频谱
subplot(4,2,1);plot(f,abs(Xa));
axis([0,500,0,1]);
但提示错误为:Error using =>plot
vectors must be the same lengths.
输入程序如下:
fs=10000;
t=0:1/fs:0.1;%采集信号长度为0.1
A=444.128;a=50*sqrt(2)*pi;b=a;
xa=A*exp(-a*t).*sin(b*t);
k=0:511;f=fs*k/512;
Xa=fft(xa);%近似模拟信号频谱
subplot(4,2,1);plot(f,abs(Xa));
axis([0,500,0,1]);
但提示错误为:Error using =>plot
vectors must be the same lengths.
![请matlab高手帮忙查下错在哪里?急](/uploads/image/z/15808963-67-3.jpg?t=%E8%AF%B7matlab%E9%AB%98%E6%89%8B%E5%B8%AE%E5%BF%99%E6%9F%A5%E4%B8%8B%E9%94%99%E5%9C%A8%E5%93%AA%E9%87%8C%3F%E6%80%A5)
这下你再试试.
fs=10000;
t=0:1/fs:0.1;%采集信号长度为0.1
A=444.128;a=50*sqrt(2)*pi;b=a;
xa=A*exp(-a*t).*sin(b*t);
k=0:1000;f=fs*k/512;
Xa=fft(xa);%近似模拟信号频谱
plot(f,abs(Xa));
k=0:511长度为512,f也是512;Xa长度1001,怎么做图啊,所以把511变成1000,就通了.
fs=10000;
t=0:1/fs:0.1;%采集信号长度为0.1
A=444.128;a=50*sqrt(2)*pi;b=a;
xa=A*exp(-a*t).*sin(b*t);
k=0:1000;f=fs*k/512;
Xa=fft(xa);%近似模拟信号频谱
plot(f,abs(Xa));
k=0:511长度为512,f也是512;Xa长度1001,怎么做图啊,所以把511变成1000,就通了.