clc;
clear;
close all;

nombre = 'ASHLEY';

bits = [];
for k = 1:length(nombre)
    bits = [bits dec2bin(double(nombre(k)),8)-'0'];
end

ami = zeros(1,length(bits));
polaridad = 1;

for i = 1:length(bits)
    if bits(i) == 1
        ami(i) = polaridad;
        polaridad = -polaridad;
    else
        ami(i) = 0;
    end
end

t = 0:length(bits);

figure;
stairs(t,[ami ami(end)],'LineWidth',2);
grid on;
title('Codificacion AMI');
xlabel('Bits');
ylabel('Voltaje');
axis([0 length(bits) -1.5 1.5]);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: