1.571 などの 10 進数を 2 進数に変換しようとすると、整数以外のすべての値が 0 になります。MATLAB で小数を 2 進数で表示する方法はありますか?
ここに私のコードの抜粋があります:
%The region between 0 and 2*pi is split up into 40 sections
N=20;
%The step is an the incrementation amount of the calculated sin
step= (2*pi)/40
%Cycle through and calculate the sin at each step
for i=1:N
C_r(i) = sin(step*i)
end
for i = 1 : N
str_r = dec2bin(C_r(i),24);
end