主题:大侠,快来帮帮忙忙~
怎么把下面一段代码在图中横坐标以信躁比形式来显示,
clear;
f1=50;
f2=120;
fs=1000;
t1=0:1/fs:(1.024-1/fs);
x1=sin(2*pi*f1*t1)+sin(2*pi*f2*t1);
x2=x1+randn(size(x1));
y1=abs(fft(x2,1024));
ff1=(0:511)*10/1024;
figure;
subplot(2,1,1)
plot(t1,x2);
subplot(2,1,2);
plot(ff1,y1(1:512));
axis([0 2 0 100]);
clear;
f1=50;
f2=120;
fs=1000;
t1=0:1/fs:(1.024-1/fs);
x1=sin(2*pi*f1*t1)+sin(2*pi*f2*t1);
x2=x1+randn(size(x1));
y1=abs(fft(x2,1024));
ff1=(0:511)*10/1024;
figure;
subplot(2,1,1)
plot(t1,x2);
subplot(2,1,2);
plot(ff1,y1(1:512));
axis([0 2 0 100]);