当前位置:新励学网 > 秒知问答 > squa函数

squa函数

发表时间:2024-07-29 11:58:25 来源:网友投稿

以在0 到 3π之间等间隔产生100个点,然后产生一个周期为2π的方波为例:

%Create a vector of 100 equally spaced numbers from 0 to 3π. Generate a square wave with a period of 2π.

clear

clc

close all

t = linspace(0, 3*pi);

x = square(t);

plot(t/pi,x,'.-',t/pi,sin(t)); %Plot the square wave and overlay a sine. Normalize the x-axis by .

xlabel('t / pi')

grid on

扩展资料

1、产生一个周期为 2π 的方波信号 。

x = square(t) generates a square wave with period 2π for the elements of the time array t. square is similar to the sine function but creates a square wave with values of –1 and 1.

2、产生一个周期为 2π的方波信号,duty表示占空比,例如duty = 30,则占空比为30%,也就是正幅度与整个周期的比值。

x = square(t,duty) generates a square wave with specified duty cycle duty. The duty cycle is the percent of the signal period in which the square wave is positive.

免责声明:本站发布的教育资讯(图片、视频和文字)以本站原创、转载和分享为主,文章观点不代表本网站立场。

如果本文侵犯了您的权益,请联系底部站长邮箱进行举报反馈,一经查实,我们将在第一时间处理,感谢您对本站的关注!