Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Hamming Distance | Algorithm | Program in MATLAB | Information Theory & Coding

MATLAB Program:

Calculate the Hamming distance between two strings. CODE: clc clear all close all x=input('Enter the first string:'); y=input('Enter the second string:'); x1=double(x); y1=double(y); c=0; for i=1:length(x1) if(x(i)~=y(i)) c=c+1; end end disp(c); Function implementation: function c = hamming(s1,s2) y1=double(s1); y2=double(s2); c=0; for i=1:length(y1) if(y1(i)~=y2(i)) c=c+1; end end end

No comments

Popular Posts