Question

(A.) Use MATLAB to generate a pulsed sine wave signal having a frequency F-10KHZ and a pulse width of T-.5ms. The pulse repet

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(A) MATLAB CODE:

clc
clear all
close all

F = 10;            % Frequency in KHz
T = 1/F;
Ts = 0.001;         % Sample time in ms
Tstop = input('Enter Tstop in ms:');
t = 0:Ts:Tstop;     % Time t in ms

% Sinusoidal with frequency F
x = sin(2*pi*F.*t);

Tp = 1;
Wp = 0.5;

% Generating Pulse with width Wp and Pulse Repetition Tp
y = [];
for n = 1:Tstop
    if n == 1
        for i = 1:length(t)
            if t(i) >= 0 & t(i) < Wp
                y = horzcat(y,1);
            elseif t(i) >= Wp & t(i) <= Tp
                y = horzcat(y,0);
            end
        end
    elseif n > 1
        for i = 1:length(t)
            if t(i) >= 0 & t(i) < Wp
                y = horzcat(y,1);
            elseif t(i) >= Wp & t(i) < Tp
                y = horzcat(y,0);
            end
        end
    end
end

z = x.*y; % Pulsed Sine Wave Signal

plot(t,z,'r')
xlabel('t in ms')
title('Pulsed Sinewave Signal')
grid on

OUTPUT:

Tstop = 1 ms

Pulsed Sinewave Signal 0.8 0.6 0.4 0.2 0 -0.2 -0.4 0.6 -0.8 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0,9 1 t in msTstop = 5 ms

Pulsed Sinewave Signal 0.8 0.6 0.4 0.2 -0.2 -0.4 -0.6 -0.8 0.5 1 1.5 2 2.5 tin ms 3 3.5 4 4,5 5(B) MATLAB CODE:

clc
clear all
close all

F = 10;            % Frequency in KHz
T = 1/F;
Ts = 0.001;         % Sample time in ms
Tstop = input('Enter Tstop in ms:');

ts = 0.01; % Sampling time interval

t = 0:Ts:Tstop;     % Time t in ms

% Sinusoidal with frequency F
x = sin(2*pi*F.*t);

Tp = 1;
Wp = 0.5;

% Generating Pulse with width Wp and Pulse Repetition Tp
y = [];
for n = 1:Tstop
    if n == 1
        for i = 1:length(t)
            if t(i) >= 0 & t(i) < Wp
                y = horzcat(y,1);
            elseif t(i) >= Wp & t(i) <= Tp
                y = horzcat(y,0);
            end
        end
    elseif n > 1
        for i = 1:length(t)
            if t(i) >= 0 & t(i) < Wp
                y = horzcat(y,1);
            elseif t(i) >= Wp & t(i) < Tp
                y = horzcat(y,0);
            end
        end
    end
end

z = x.*y; % Pulsed Sine Wave Signal

stem(t*ts,z,'r')
xlabel('n')
title('Sampled Pulsed Sinewave Signal')

OUTPUT:

Tstop = 1 ms

Sampled Pulsed Sinewave Signal 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 0.004 0,005 0.007 0.01 0.001 0.002 0.003 0.006 0.008 0.0Tstop = 5 ms

Sampled Pulsed Sinewave Signal S pas 0.8 0.6 0,4 0.2 0 -0.2 -0.4 -0.6 0.8 0.005 0.03 0.035 0.05 0.01 0.015 0.02 0.025 0.04 0.

Add a comment
Know the answer?
Add Answer to:
(A.) Use MATLAB to generate a pulsed sine wave signal having a frequency F-10KHZ and a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT