How should I plot a square wave signal by utilising fourier series?
3 次查看(过去 30 天)
显示 更早的评论
How should I code this square wave by utlising fourier series signal? I do not have any idea how to do so.
The amplitude and period of the graph is both 1.
2 个评论
回答(1 个)
Star Strider
2024-9-24
A relatively straightforward approach to creating a square wave pulse train from sinusoids is to do something like this —
Fs = 1000;
L = 10;
t = linspace(0, Fs*L, Fs*L+1).'/Fs;
fv = 1:2:100;
s = sum(sin(2*pi*t*fv) ./ fv,2);
figure
plot(t, s)
grid
axis('padded')
Adapt it to your requirments.
.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!