matlab产生单音信号的时域、频域图

clc;
close all;
clear all;

fs = 100e3; % 采样频率
fc1=10e3;
fc2=20e3;
L = 2048; % 显示点数
t = 0:1/fs:(L-1)/fs; %采样点
% 测试信号
y = cos(2*pi*fc1*t)+cos(2*pi*fc2*t)+0.1*randn(size(t));
fy = fft(y,L);
% 作图1
freq=linspace(0,fs,L);
figure(1)
subplot(2,1,1);
plot(t,y);grid on;
xlabel('时间(s)');ylabel('振幅'); title('信号时域图');
subplot(2,1,2);
plot(freq,fy);grid on; % 这种方式会显示镜像频率
xlabel('频率(Hz)');ylabel('幅度'); title('信号频域图'

matlab产生单音信号的时域、频域图最先出现在Python成神之路

版权声明:
作者:ht
链接:https://www.techfm.club/p/14045.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>