フィルターのクリア

How can I plot a square wave in Matlab

2 ビュー (過去 30 日間)
Mallouli Marwa
Mallouli Marwa 2018 年 11 月 30 日
回答済み: Star Strider 2018 年 11 月 30 日
Hello
As attached the square wave equation.
How can I plot it ?

採用された回答

Star Strider
Star Strider 2018 年 11 月 30 日
Try this:
f = 5; % Frequency
N = 16; % Order Of Harmonics
t = linspace(0, 4, 500); % Time Vector
sqwv = @(f,t,n) 4*sum(bsxfun(@rdivide, sin(2*pi*(1:2:N)'*t), (1:2:N)'))/pi;
figure
plot(t, sqwv(f,t,N))
grid

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by