Matlab piecewise function tranformation to step and ramp
Mostra commenti meno recenti
How can I transform piecewise function into ramp and step function? For example, I program matlab where it asks for piecewise function as input and then it takes these functions and decompose it into ramp and step function so that my output will be like a*x(t+n) +..... , where a is the value of the ramp/step a, n is the shift on the x-axis and x defining either ramp( r ) or step ( u )
Risposte (1)
Star Strider
il 5 Nov 2020
Experiment with these:
u = @(t) t>0; % Unit Step Function
r = @(t,a,b) (t.*a).*((t>=0) & (t<=b)); % Ramp With Slope ‘a’ And Time Limit ‘b’
t = linspace(0, 5, 250);
figure
subplot(2,1,1)
plot(t, u(t-2.5))
grid
ylim([-1 1]*1.1)
subplot(2,1,2)
plot(t, r(t-0.5, 2, 4-0.5))
grid
ylim([-1 10]*1.1)
.
2 Commenti
Osama Aliwat
il 5 Nov 2020
Star Strider
il 5 Nov 2020
Apparently, this is an assignment or exercise. It would be best if you experiment to produce the desired result from my example functions or functions you write.
Categorie
Scopri di più su Fourier Analysis and Filtering in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
