Skip to main content

Mat lab program to plot the ask modulated wave for a given binary sequence

 %program to plot ask modulated wave
clc;
clear all;
close all;
f=2;
t=0:(2*pi)/99:2*pi;
g=input('Enter the binary sequence to be modulated ');
bit=[];mod=[];c=[];cp=[];
for i=1:length(g)
    if g(i)==0
        die=zeros(1,100);
        sp=zeros(1,100);
    else g(i)==1
        die=ones(1,100);
        sp=ones(1,100);
    end
    c=sin(f*t);
    bit=[bit die];
    mod=[mod c];
    cp=[cp sp];
end
ask=cp.*mod;
subplot(2,1,1)
plot(bit);
title('Binary bit pattern');
axis([0 100*length(g) -2.5 2.5])
grid on;
subplot(2,1,2)
plot(ask);
axis([0 100*length(g) -2.5 2.5])
title('ASK modulated signal');
grid on;

Comments

Popular posts from this blog

ASCII to Decimal conversion

#include "msp430.h"                     ; #define controlled include file         NAME    main                    ; module name         PUBLIC  main                    ; make the main label vissible                                         ; outside this module         ORG     0FFFEh         DC16    init                    ; set reset vector to 'init' label         RSEG    CSTACK                  ; pre-declaration of segment         RSEG    CODE      ...

Event Sourcing with CQRS.

  The way event sourcing works with CQRS is to have  part of the application that models updates as writes to an event log or Kafka topic . This is paired with an event handler that subscribes to the Kafka topic, transforms the event (as required) and writes the materialized view to a read store.