Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Generation of Square wave using Sinwave

MATLAB Program:


%% Time specifications:

Fs = 10000; % samples per second

dt = 1/Fs; % seconds per sample

StopTime = 6*pi; % seconds

t = (0:dt:StopTime-dt)'; % seconds



%% Sine wave:

Fc = 0.15; % hertz

x = sin(2*pi*Fc*t);

% Plot the signal versus time:

figure;

plot(t,x);

xlabel('time (in seconds)');

title('Signal versus Time');

%%

%Square wave generation:

y=square(t);

% Plot the signal versus time:

figure;

plot(t,y);

xlabel('time (in seconds)');

title('Signal versus Time');







No comments

Popular Posts

Followers