Creating Continuous Time Triangle in Matlab
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need to create a continuous time triangle wave in Matlab that follows the following Pseudo Code:
Triangle = { 1 - abs(t/2) for -2<=t<=2 0 otherwise
Basically, I want a triangle centered on 0, with a max height of 1, that goes from -2 to 2.
I can do it in discrete time with the following code:
a = 2;
t = -a:0.001:a; %define time from -2 to 2
triangle = 1-abs(t/a); %triangle function with max height of 1.
plot(t,triangle)
but I haven't the foggiest how to make this into a continuous time function. Any help would be greatly appreciated.
0 commentaires
Réponses (1)
Image Analyst
le 19 Mar 2013
Use repmat().
a = 2;
t = -a:0.001:a; %define time from -2 to 2
triangle = 1-abs(t/a); %triangle function with max height of 1.
numberOfReplications = 3;
triangleWave = repmat(triangle, [1, numberOfReplications]);
plot(triangleWave)
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!