calc.m

来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 36 行

M
36
字号
%=====================================================
% 信号的时域运算  程序名:calc.m
% 本程序给出两个信号之间的乘法,并画出相应的波形图
% 设两个信号分别为:f1(t)=sin(pi*t),f2(t)=sin(8*pi*t)
%=====================================================
clear;
t=-5:0.01:5;
w1=input('w1=');
w2=input('w2=');
f1=sin(w1*t);
clf;
subplot(2,2,1);
plot(t,f1);
axis([-5,5,-1.2,1.2]);
grid on;
title('f1=sin(w1*t)')
f2=sin(w2*t);
subplot(2,2,2);
plot(t,f2);
axis([-5,5,-1.2,1.2]);
grid on;
title('f2=sin(w2*t)')
f3=f1.*f2;
subplot(2,2,3);
plot(t,f3);
axis([-5,5,-1.2,1.2]);
grid on;
title('f3=f1*f2');
f4=f1+f2;
subplot(2,2,4);
plot(t,f4);
axis([-5,5,-1.2,1.2]);
grid on;
title('f3=f1+f2');
%====================================================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?