我正在尝试编写代码以绘制负阶跃函数(该函数在t *
x = zeros (size (t));
ind2= t<1000;
x(ind2)=0;
ind = t >= 1000 & t < inf;
x(ind) = -20*10^-5;
endfunction
有人可以建议我回答吗?谢谢
答案 0 :(得分:0)
这项工作可以吗?
clear;clf;
## usage: Pristep = Heaviside (t,tstar,amplitude)
##
##
function Pristep = Heaviside (t,tstar,amplitude)
Pristep=zeros(size(t));Heavisideon=find(t>tstar)
Pristep(Heavisideon)=amplitude*ones(size(Heavisideon));
endfunction
%% example:
nt=101;t=linspace(-10,10,nt);
plot(t,Heaviside(t,pi,-exp(1)))