📄 p6_16.m
字号:
% P6_16.M Create pulse of arbitrary length% clearclf% Input Pulse length Tstart=input('Input Tstart of pulse = ')Tend=input('Input Tend of pulse = ')Tfinal=input('Input Final time Tfinal = ')N=input('Number of points in pulse = ')%% Pulse_to_plot - a column vector of length length_t%deltat=(Tend-Tstart)/Nt=[Tstart:deltat:Tfinal];length_t=length(t)for i=1:length_t if t(i) < Tstart pulse_to_plot(i) = 0; elseif (Tstart <= t(i)) & (t(i) <= Tend) pulse_to_plot(i) = 1; elseif t(i) > Tend pulse_to_plot(i) = 0; endend%pulse_to_plot= (pulse_to_plot)';plot(t,pulse_to_plot,'*') % Plot the solutiontitle('Plot of Pulse')xlabel('Time')ylabel('Pulse')gridzoom%% Add comments to define the input variables and output.%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -