?? samp2_16.m
字號(hào):
%Samp2_16
dt=0.01; %信號(hào)的采樣間隔
t=0:dt:4*pi; %時(shí)間序列
y1=sin(t); %原始正弦函數(shù)值序列
subplot(3,1,1),plot(t,y1),title('原始信號(hào)')
%繪出原始正弦信號(hào)
y2=diff(y1)/dt; %對(duì)信號(hào)進(jìn)行微分
subplot(3,1,2),plot(t,[0,y2]) ,title('微分后信號(hào)')
%繪出微分后的信號(hào),因?yàn)槲⒎趾笮盘?hào)比原信號(hào)少一個(gè)元素,用零補(bǔ)。
for i=1:length(y2)
y3(i)=sum(y2(1:i))*dt;
end
%將原始信號(hào)微分后的y2進(jìn)行積分
subplot(3,1,3),plot(t,[0 y3]) ,title('積分后信號(hào)'),xlabel('時(shí)間/s')
%繪出積分后信號(hào)圖
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -