how to generate triangular wave form ?
1 view (last 30 days)
Show older comments
i need triangular wave form using given equation in attached file, i am trying but something being wrong, please help my code is ::
clc;
clear all;
%triangular wave form
Imax=0.8;
Imin=0.2;
Im=Imax-Imin;
T = 20;
s = @(x) ((2*Im*x/T)+Imin+Im/2).*(0<=x & x<=T/4) - ((2*Im*x/T)+Imin+3*Im/2).*(T/4<=x & x<=3*T/4)+((2*Im*x/T)+Imin-3*Im/2).*(3*T/4<=x & x<=T);
x = linspace(0, 20);
X = repmat(x, 1000, 10);
sv = s(x);
figure(2)
plot(x,sv)
hold on
for k1 = 20:20:60
plot((x+k1),sv)
end
hold off
for more detail please find attachment
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166474/image.png)
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox 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!