Вы находитесь на странице: 1из 1

!

1, 50% 0.01/2^3 ., 3-
. 0.01 .
10100101, workspace "11111111 00000000 1111111 0000000 0000000 1111111
0000000 1111111". ???
. m-
:
n=8; %
a=dec2bin(abs('10100101')*2^n,n); % 10 2
b=bin2dec('01000011'); % 2 10
y=(abs(b))/2^n;
y=
0.26171875
'10100101', workspace.
S-:
function [sys,x0,str,ts] = binTWOdec(t,x,u,flag)
a=dec2bin(abs('u')*2^8,8); % 10 2
b=bin2dec('u'); % 2 10
switch flag,
case 0
[sys,x0,str,ts]=mdlInitializeSizes;
case 3
sys=mdlOutputs(t,x,u,a,b);
case { 1, 2, 4, 9 }
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes()
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs = -1;
sizes.NumInputs = -1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
str = [];
x0 = [];
ts = [-1 0];
function sys = mdlOutputs(t,x,u,a,b)
sys = abs(b)/2^8;
:
Error in 'EROM/Subsystem/S-Function' while executing M-File S-function 'binTWOdec', flag = 0 (initialize), at start of
simulation. MATLAB error message:
Binary string may consist only of characters 0 and 1

Вам также может понравиться