信号运算的 MATLAB 实现
本文涉及内容,均可在matlab的命令窗口执行!实现使用 MATLAB 实现常用连续信号的运算。
信号基本运算是乘法、加法、尺度、反转、平移、微分、积分,实现方法有数值法和符号法。
1.信号的尺度变换、平移及反转
假设f(t)为三角信号,求f(2t)和f(2-2t)。
代码如下:
t=-3:0.001:3;
ft=tripuls(t,4,0.5);
subplot(3,1,1);
plot(t,ft); grid on;
title ('f(t)');
ft1= tripuls(2*t,4,0.5);
subplot(3,1,2);
plot(t,ft1); grid on;
title ('f(2t)');
ft2= tripuls(2-2*t,4,0.5);
subplot(3,1,3);
plot(t,ft2); grid on;
title ('f(2-2t)');
结果如图:
2.信号的加法、乘法
假设f1(t)=sinwt , f2(t)=sin8wt , w=2pi , 求 f1(t)+f2(t)和 f1(t)*f2(t) 的波形图。
代码如下:
w=2*pi;
t=0:0.01:3;
f1=sin(w*t);
f2=sin(8*w*t);
subplot(211)
plot(t,f1+1,':',t,f1-1,':',t,f1+f2)
grid on,title('f1(t)+f2(t))')
subplot(212)
plot(t,f1,':',t,-f1,':',t,f1.*f2)
grid on,title('f1(t)*f2(t)')
3.信号的积分
求下列积分:
代码如下:
clear %清除变量
syms a x y3 y4
y3=x^5-a*x^2+sqrt(x)/2;
y4=(x*exp(x))/(1+x)^2;
iy3=int(y3,'x')
iy4=int(y4,0,1)
本文给出基础的例子供大家学习!