How can I create an impulse wave via triangular pulse
Show older comments
I need to create an impulse wave, through a triangular pulse. I succeded that with the rectangular, but the triangular doesn't seem to work for me.
body of my code:
syms a;
a=0.1;
t=linspace(-0.2,0.2,1000000);
y=zeros(1,1000000);
x=abs(t);
y(x<a)=(1/a)*(1-x);
plot(t,y);
grid;
The error matlab shows me is:
Unable to perform assignment because the left and right sides have a different number of elements.
Error in rectangular_pulse (line 133) (the file name is rectangular pulse)
y(x<a)=(1/a)*(1-x);
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!