Manipulate amplitude without using linspace
1 次查看(过去 30 天)
显示 更早的评论
I have a signal which I converted to a square wave however, the amplitude needs to be set in a range of -2 to 1 without using linspace. Here is the code I have so far
t=0:0.1:2*pi
x_t1=sin(2*pi*t)+3*cos(6*pi*t);
x_t=square((x_t1/0.5),25)-1;%creates square wave with a period of 0.5 and duty cycle of 25 percent, subtracting 1 makes amplitude -2 to 0
plot(x_t)
I know the square function automatically makes the amplitude range -1 to 1 but I am stuck on how else to manipulate the code. Thank you for the help
0 个评论
采纳的回答
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!