Can you provide the triangular wave function? Once you have that, we can determine the translational shift on the x-axis.
Transport delay generate to matlab function
6 views (last 30 days)
Show older comments
Hello
I wanted to draw the same triangular waves with phase shifting using transport delay and I succeeded. But I want to do this using matlab function. How can I do it?


Answers (1)
Sam Chak
on 21 Feb 2025
Hi @Enes
I applied the modulo operation to the triangular membership function from the Fuzzy Logic Toolbox to create the equilateral triangular wave. You can adjust the base length (period) and the phases to suit your application. Personally, I prefer the trimf() function, but you may also use the sawtooth() function. If you would like to create your own version of the triangular function, please replace the trimf() function accordingly. The MATLAB Function block should support the mod(), trimf(), and sawtooth() functions.
t = linspace(0, 4*sqrt(3), 7001);
p = 2/sqrt(3); % period (base length of Equilateral triangle)
z1 = mod(t - 0*p/4, p); % modulo operation
z2 = mod(t - 1*p/4, p);
z3 = mod(t - 2*p/4, p);
z4 = mod(t - 3*p/4, p);
y1 = trimf(z1, [0*p 1*p/2 1*p]); % blue
y2 = trimf(z2, [0*p 1*p/2 1*p]); % red
y3 = trimf(z3, [0*p 1*p/2 1*p]); % orange
y4 = trimf(z4, [0*p 1*p/2 1*p]); % purple
plot(t, [y1; y2; y3; y4]), grid on, axis equal
xlabel('Time'), ylabel('Amplitude')
2 Comments
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!