首页 > 其他 > 详细

信号基础知识

时间:2019-04-15 12:26:33      阅读:146      评论:0      收藏:0      [点我收藏+]

总是基础的知识老是忘,所以记录一下吧。

clc;close all;clear all; f0=10; fs=100;     %采样率 t=1/fs:1/fs:2;         %共两秒钟,共200个采样点。采样间隔T=1/100

y1=sin(2*pi*f0*t);

y2=square(2*pi*f0*t);

figure;

subplot(311); plot(t,y1); xlabel(‘time‘);ylabel(‘y1‘);title(‘y1=sin(2*pi*f0*t)---时域‘);

subplot(312); plot(t,y2); xlabel(‘time‘);ylabel(‘y2‘);title(‘y1=square(2*pi*f0*t)---时域‘);

noise=rand(1,200); subplot(313); plot(t,noise,‘r‘); xlabel(‘time‘);ylabel(‘noise‘);title(‘noise---时域‘);技术分享图片

技术分享图片

%--------------------------------------------------------

z1=y1+noise;

z2=y2+noise;

figure;

subplot(211); plot(t,z1); xlabel(‘time‘);ylabel(‘z1‘);title(‘y1=sin(2*pi*f0*t)+noise---时域‘); axis([0 0.5 0 2]);

subplot(212); plot(t,z2); xlabel(‘time‘);ylabel(‘y2‘);title(‘y1=square(2*pi*f0*t)+noise---时域‘); axis([0 0.5 0 2]);

技术分享图片

xiangguan_z1z2=xcorr(z1,z2);%%相关分析

juanji_z1z2=conv(z1,z2); %%卷积

figure;

subplot(311); plot(xiangguan_z1z2); title(‘相关性---z1z2‘);

subplot(312); plot(juanji_z1z2); title(‘卷积---z1z2‘);

subplot(313); plot(xiangguan_z1z2,‘r‘);hold on;

plot(juanji_z1z2,‘g‘);hold off;

legend(‘相关性---z1z2‘,‘卷积---z1z2‘);%卷积和相关不一样emmmm

技术分享图片

信号基础知识

原文:https://www.cnblogs.com/kiki--xiunai/p/10709911.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!