7, 2012
. 1
. . 3 3, 0 . 3 ? 0 7 000 111.
3 /. 3 0 3 . .
, : 000 0 001 1 010 2 011 3 100 4 101 5 110 6 111 7 , . : 999 . 9999
10
= 10011100001111
2
3 1 /. 010 011 100 001 111
1 0
7, 2012
. 2
, 23417
8
. 8
. , . , .
.
% program desimal ke octal
clear all;
close all;
clc;
%%
% Konversi nilai desimal ke biner
desimal=9999;
bit=des2binn(desimal);
% Mengkondisikan jumlah anggota vektor agar sesuai
ttemp=[zeros(1,3-rem(length(bit),3)) bit];
% Konversi nilai Biner ke Octal
temp=fliplr(ttemp);
okta=[];
for m=1:3:length(temp)
k=0;
tempp=0;
for n=m:m+2
tempp=tempp+temp(n)*(2^k);
k=k+1;
end
okta=strcat(num2str(tempp),num2str(okta));
end
okta=str2double(okta);
disp('Desimal');
disp(desimal);
disp('Biner');
disp(ttemp);
disp('Octal');
disp(okta);
%% jans hendry
7, 2012
. 3
. . ...
Reward Your Curiosity
Everything you want to read.
Anytime. Anywhere. Any device.
No Commitment. Cancel anytime.