Square Wave Generation becomes inaccurate !
Show older comments
Hi there! can someone help me please ? I have a problem with this here. When I generate the square wave after a while it becomes inaccurate! I need this Period:[1 1 1 1 -1 -1 -1 -1], N times. But it makes somewhere a mistake and I have after some Periods three times 1 or five times -1 and so on!
and I need help to make a square wave like this ->
Period:[1 1 -1 -1 -1 -1 1 1], N times, too.
Thanks a lot.
f_r=4;
spp = 8; % Samples per Period
N=1000;
t = 0:1/(spp*f_r):N-1/(spp*f_r); % (time)
f_Sq = 4;
A_Sq = 1;
W_Sq = floor(2*pi*f_Sq);
S_Sq = A_Sq*square(t*W_Sq);
Accepted Answer
More Answers (0)
Categories
Find more on App Building 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!