?? exm0212_4.m
字號(hào):
%exm0212_4.m
t=linspace(0,3*pi,500);y=sin(t);%產(chǎn)生正弦波
%從自變量著手進(jìn)行逐段處理。
z1=((t<pi)|(t>2*pi)).*y; %獲得整流半波 <3>
w=(t>pi/3&t<2*pi/3)+(t>7*pi/3&t<8*pi/3);%關(guān)系邏輯運(yùn)算和數(shù)值運(yùn)算 <4>
w_n=~w; % <5>
z2=w*sin(pi/3)+w_n.*z1; %獲得削頂整流半波 <6>
clf
subplot(1,3,1),plot(t,y,':r'),ylabel('y')
subplot(1,3,2),plot(t,z1,':r'),axis([0 10 -1 1])
subplot(1,3,3),plot(t,z2,'-b'),axis([0 10 -1 1])
shg
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -