The answer is No! .I am not aware of any function which can do that for you. Try to adapt my function for your needs or write your own.
[t,p]=Trapezoidal_pulse(1,3,0.01,1,1,5,8);
figure,plot(t,p)
The function:
function [t,pulse_train]=Trapezoidal_pulse(Amplitude,FlatTopTime,DwellTime,RiseTime,FallTime,DeadTime,Repetitions)
if(RiseTime<DwellTime)
warn('RiseTime<DwellTime: No Ramp up samples')
rampup_samples=[];
else
rampup_samples= linspace(0,Amplitude,ceil(RiseTime/DwellTime));
end
if(FallTime<DwellTime)
warn('FallTime<DwellTime: No Ramp down samples')
rampdown_samples=[];
else
rampdown_samples= linspace(Amplitude,0,ceil(FallTime/DwellTime));
end
pulse=[rampup_samples Amplitude*ones(1,ceil(FlatTopTime/DwellTime)) rampdown_samples zeros(1,ceil(DeadTime/DwellTime))];
pulse_train=repmat(pulse,[Repetitions 1]).';
pulse_train=pulse_train(:);
t=(0:(length(pulse_train)-1))*DwellTime;
end
Use doc or edit command to see the ownership and year at which the function is added to matlab.
Best Answer