Write a MATLAB Program to implement OR Gate AND Gate and XOR

Write a MATLAB Program to implement OR Gate, AND Gate and XOR Gate. Write a MATLAB program to do the following: If input bit is 0: A sinusoidal signal with frequency f If input bit is 1: A sinusoidal signal with frequency f1 Amplitude Shift Keying (ASK): -change amplitude with each symbol - frequency constant -low bandwidth requirements -very susceptible to interference Frequency Shift Keying (FSK): -change frequency with each symbol -needs larger bandwidth Phase Shift Keying (PSK) -Change phase with each symbol -More complex -robust against interference

Solution

(1)

clear all
close all
clc
% OR GATE
Y_OR=[or(0,0) or(0,1) or(1,0) or(1,1)]
% AND GATE
Y_AND=[and(0,0) and(0,1) and(1,0) and(1,1)]
% XOR GATE
Y_XOR=[xor(0,0) xor(0,1) or(1,0) xor(1,1)]

sample output


Y_OR =

0 1 1 1


Y_AND =

0 0 0 1


Y_XOR =

0 1 1 0

>>

(2)

clear all
close all
clc
f=100;
f1=1000;
t=0:0.1:10;
x=input(\'Enter input bit 0 or 1 :\');
if x==0
Y=sin(2*pi*f*t);
plot(t,Y)
elseif x==1
Y=sin(2*pi*f1*t);
plot(t,Y)
else
disp(\'Invalid input\')
end

 Write a MATLAB Program to implement OR Gate, AND Gate and XOR Gate. Write a MATLAB program to do the following: If input bit is 0: A sinusoidal signal with fre

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site