generating periodic trapezoidal waves with ramps
49 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I want to generate a periodic trapezoidal wave that has 'ramps' on both sides of the wave structure. I was able to generate square waves that does not have ramps using the following codes.
Pwr_avg = 200; % [W] average input power
nu_p = 2e3; % [Hz]=[1/s] pulse repetition frequency
tau_p = 1/nu_p; % [s] pulsed period
f_DC = 0.15; % [%] duty cycle (=fraction of the pulsed period power is on)
tau_on = tau_p * f_DC; % [s] length of time power is on during each pulsed period
tau_ramp = 1e-6; % [s] ramp up/down time
Pwr_max = Pwr_avg * (tau_p/tau_on); % [W] maximum power during the pulsed period during 0<t<=tau_on
Pwr_min = 1e-4; % [W] arbitrary small value during the 'off' period
d = tau_on/2:tau_p:t_max;
Pwr = Pwr_max * pulstran(t_array,d,'rectpuls',tau_on); % generate periodic power input
Pwr(Pwr==0) = Pwr_min; % assign arbitrary small power input during 'off' period
Pwr = Pwr / (pi*r_cyl^2*l_cyl) * 1e3; % [mW/cm3] input power array
The code above use pulse train function to generate periodic structure, which is used to simulate pulsed power. The absolute zero values for the power is not ideal for my application, so I assigned arbitrary small value when the power is 'off'.
Here, I would like to introduce a ramp up/down time as the power increases from zero, and decreases back to zero. So the pulsed waveform will become trapezoid that has steep ramps. I would like to know how to add ramps on this square wave or if Matlab already has inherent function I can use.
Thank you for your time
1 Kommentar
Mathieu NOE
am 7 Dez. 2020
hello
I do not see the trapezoidal signal as being part of the available options in
several options :
implement a rate limiter like described in :
or apply a first order low pass filter (not truly a trapezoidal shape though)
Antworten (1)
Amrtanshu Raj
am 23 Dez. 2020
Hi,
The pulstran function allows you to input custom function handles to generate custom waveforms. You can use this equation to create a trapezoidal wave and pass it to pulstran function to get the trapezoidal waveform and then tune it as per need.
%equation
a = 10 %Amplitude
m = 5 %Time Period
l = 5 %Horizontal Spread
c = 2 %Vertical Spread
x = 0:.1:10 %Sample Points
Trapezoidal_Wave = a/pi*(asin(sin((pi/m)*x+l))+acos(cos((pi/m)*x+l)))-a/2+c;
1 Kommentar
Siehe auch
Kategorien
Mehr zu Waveform Generation finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!