用matlab画NRZ的时域图和频域图
(2018-03-13 11:55:49)分类: matlab设计 |
clear all
clc
closeall
x=rand(1,500)>0.5;
Fs=10;
x= x(1,:);
x= x';
N= length(x);%求取抽样点数
t= (0:N-1)/Fs;%显示实际时间
y= fft(x);%对信号进行傅里叶变换
f= Fs/N*(0:round(N/2)-1);%显示实际频点的一半
subplot(211);
plot(t,x,'g');%绘制时域波形
axis([0max(t) -1 1]);
xlabel('Time/ (s)');ylabel('Amplitude');
title('信号的波形');
grid;
subplot(212);
plot(f,abs(y(1:round(N/2))));
xlabel('Frequency/ (s)');ylabel('Amplitude');
title('信号的频谱');
grid;
clc
close
x
Fs=10;
x
x
N
t
y
f
subplot(211);
plot(t,x,'g');%绘制时域波形
axis([0
xlabel('Time
title('信号的波形');
grid;
subplot(212);
plot(f,abs(y(1:round(N/2))));
xlabel('Frequency
title('信号的频谱');
grid;
前一篇:[转载]MATLAB做信号频谱图
后一篇:matlab FFE均衡