Simplest Example in Delta Encoding and Decoding

Version 1.0.1 (1.17 KB) by Hamza Irfan
this MATLAB code implements delta encoding compression on a dataset of 20 elements. the program performs compression and decompression.
35 Downloads
Updated 22 Nov 2020

View License

consider the data created by the following commands
x=0.51: 0.01:0.7;
data =round(sin(x),3);
data=1000*data

to do delta encoding on a dataset, the first element of the dataset is saved
compressed_data(1)=data(1);
the second element of the compressed data will contain the difference from second element to first element and so, on till the last element.

for i =2:length(data)
compressed_data(i)=data(i)-data(i-1);
end
for the decompression the first entry of the compressed data will be the first element of the decompressed data and the second element will be the sum of second element t of the compressed data and the first element of the decompressed data,

decompressed_data(1)=compressed_data(1);
for i =2:length(compressed_data)
decompressed_data(i)=compressed_data(i)+decompressed_data(i-1);

end

Cite As

Hamza Irfan (2026). Simplest Example in Delta Encoding and Decoding (https://www.mathworks.com/matlabcentral/fileexchange/83168-simplest-example-in-delta-encoding-and-decoding), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.1

description updated

1.0.0