Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear;
- clc;
- Fs = 50000; %sampling freq
- f1 = 1000; %signal freq
- N = Fs / f1; % samples
- n = 0:N-1; % sample number
- x = sin( 2*pi*(f1/Fs)*n );
- %subplot(2,1,1); plot( n/Fs, x, '-*'); % n/Fs - signal freq
- %subplot(2,1,2); plot( n, x, '-*');
- for i = n+1
- if ( n(i) < 30 )
- x = sin( 2*pi*(f1/Fs)*n );
- end
- if ( n(i) > 30 )
- x(i) = 1;
- end
- if ( n(i) > 40 )
- x(i) = 0;
- end
- end
- plot(n,x);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement