Creating Continuous Time Triangle in Matlab
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Image Analyst
am 19 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!