⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makegi.m

📁 This is a collection of m-files I created to complete a research project into the DC components of v
💻 M
字号:
%makeGI(in)
%   This function creates a random sequence of a 'in' bits
%   (rounded up to the nearest word length [9]) valued at 0
%   and 1, which satifies a (0, 4/4) constraint.  This is
%   an NRZI code.

function out = makeGI(in);

in = in + (9 - mod(in,9));

legit = [073 075 076 077 078 079 089 090 091 092 093 094 095 097 099 100 101 102 103 105 107 ...
         108 109 110 111 113 114 115 116 117 118 119 121 122 123 124 125 126 127 146 147 150 ...
         151 153 154 155 156 157 158 159 177 178 179 180 181 182 183 185 186 187 188 189 190 ...
         191 195 198 199 201 203 204 205 206 207 210 211 214 215 217 218 219 220 221 222 223 ...
         225 227 228 229 230 231 233 235 236 237 238 239 241 242 243 244 245 246 247 249 250 ...
         251 252 253 254 255 265 267 268 268 270 271 281 282 283 284 285 286 287 289 291 292 ...
         293 294 295 297 299 300 301 302 303 305 306 307 308 309 310 311 313 314 315 316 317 ...
         318 319 329 331 332 333 334 335 345 346 347 348 349 350 351 353 355 356 357 358 359 ...
         361 363 364 365 366 367 369 370 371 372 373 374 375 377 378 379 380 381 382 383 390 ...
         391 393 395 393 397 398 399 402 403 406 407 409 410 411 412 413 414 415 417 419 420 ...
         421 422 423 425 427 428 429 430 431 433 434 435 436 437 438 439 441 442 443 444 445 ...
         446 447 451 454 455 457 459 460 461 462 463 466 467 470 471 473 474 475 476 477 478 ...
         479 481 483 484 485 486 487 489 491 492 493 494 495 497 498 499 500 501 502 503 505 ...
         506 507 508 509 510 511];

codebook = zeros(279,9);
    for i = 1:279
        thistime = legit(i);
        codebook(i,1:length(de2bi(thistime))) = de2bi(thistime);
    end
codebook = fliplr(codebook);

chain = [];
while length(chain) < in
    a = randunifd(1,length(legit));
    word = codebook(a,1:9);
    chain = [chain word];
end

out = chain;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -