Skip to main content

Posts

Showing posts from March, 2021

Phase modulation for square waveform IN MATLAB

MATLAB CODE fm = 1000;fm=7; Tm=1/fm; Ac = 1; Am=1; t = 0:Tm/999:Tm*2; fc =30; s=square(2*pi*t*fm); subplot(2,1,1); plot (t,s); title ('Square Waveform'); grid on; K= 2*pi*0.333 y2=Ac*cos(2*pi*fc*t+K*s); subplot(2,1,2); plot(t,y2); grid on; title('phase Modulated signal');                                                                                                    Output Inference:      In square wave as message signal phase changes from 180      degrees to -180 degrees so the PM signal also changes direction      suddenly and give sharp point.

MATLAB code for phase modulation

  Theory Phase modulation is a modulation pattern for conditioning communication signals for transmission.  In phase modulation carrier signal phase changes w.r.t message signal.                                                                                        MATLAB Code fm = 1000; fc =10*10^3; Am = 1; K=2*pi*5; Ac = 1; Tm = 1/fm; Tc = 1/fc; t = 0:Tm/999:2*Tm; %message signal plot modulating_signal = Am*sin(2*pi*fm*t); subplot(2,1,1); plot(t, modulating_signal); grid on; title('message signal'); xlabel('time'); ylabel('amplitude') %phase modulation signal plot with Am=5 y1=Ac*cos(2*pi*fc*t+K*modulating_signal); subplot(2,1,2); plot(t,y1); grid on; title('phase Modulated signal'); xlabel('time'); ylabel('amplitude')                                                                                  Output On increasing amplitude output changes as Inferences When message signal is increasing, the phase change is positive w.r.t carrier si

Amplitude Modulation signal using MATLAB

                                                                     THEORY In   amplitude modulation , the  amplitude  (signal strength) of the carrier wave is varied in proportion to that of the message signal, such as an audio signal.  Modulation is the process of converting data into electrical signals optimized for transmission.                                                                  MATLAB Code: fm = 1000; fc =100*10^6; Mp = 1; Mu=1.5; Ac = Mp/Mu; Tm = 1/fm; Tc = 1/fc; t = 0:Tm/999:6*Tm; %message signal plot modulating_signal = Mp*sin(2*pi*fm*t); subplot(3,1,1) plot(t, modulating_signal); grid on; title('modulating signal'); xlabel=('time(sec)'); ylabel=('voltage(V)'); %carrier signal plot carrier_signal = Ac*sin(2*pi*fc*t); subplot(3,1,2) plot(t, carrier_signal); grid on; title('Carrier Signal'); xlabel=('time(sec)'); ylabel=('voltage(V)'); %modulated signal plot Y= (modulating_signal+Ac).*sin(2*pi*fc*t); subplot(3,1,3) pl

Designing a 8X1 MUX using logic gates in Verilog. Verilog code and test bench.

Circuit Diagram Verilog Code module MUX_8x1 ( output Y, input A,B,EN, input [2:0] SEL); assign Y=EN&((A&B)&(~SEL[0]&~SEL[1]&~SEL[2])|(A|B)&(~SEL[0]&~SEL[1]&SEL[2])|(~A)&(~SEL[0]&SEL[1]&~SEL[2])|(~B)&(~SEL[0]&SEL[1]&SEL[2])|(~(A&B))&(SEL[0]&~SEL[1]&~SEL[2])|~(A|B)&(SEL[0]&~SEL[1]&SEL[2])|(~A&B|A&~B)&(SEL[0]&SEL[1]&~SEL[2])|(A&B|~A&~B)&(SEL[0]&SEL[1]&SEL[2])); endmodule                                                                     Test bench `timescale 1ns / 1ps module MUX_8x1_tb; // Inputs reg A; reg B; reg EN; reg [2:0] SEL; // Outputs wire Y; MUX_8x1 uut ( .A(A),  .B(B),  .EN(EN),  .SEL(SEL),  .Y(Y) ); initial begin // Initialize Inputs A = 1'b0; B = 1'b0; EN= 1'b1; SEL= 3'b111; // Wait 10 ns for global reset to finish #10; A = 1'b0; B = 1'b1; EN= 1'b1; SEL= 3&