Programming Fundamentals - The MathWorks - #451

/ 840


catalogue search
P. 451
P. 452
P. 453
P. 454
P. 455
P. 456
P. 457
P. 458
P. 459
P. 460
P. 461
P. 462
P. 463
P. 464
P. 465
P. 466
P. 467
P. 468
P. 469
P. 470
P. 471
P. 472
P. 473
P. 474
P. 475
P. 476
P. 477
P. 478
P. 479
P. 480
P. 481
P. 482
P. 483
P. 484
P. 485
P. 486
P. 487
P. 488
P. 489
P. 490
P. 491
P. 492
P. 493
P. 494
P. 495
P. 496
P. 497
P. 498
P. 499
P. 500


See other catalogues for The MathWorks

Text version of the page
Nested Functions
[filt1, state1] = makeFilter([1 0], [1 -.5]); % First input to the filter is 1.
filt1(1)
ans =
1
% Second input to the filter is 0.
filt1(0)
ans =
0.5000 filt1(0)
ans =
0.2500
% Show the filter's internal state.
state1()
ans =
0.2500 0.1250
% Hit the filter with another impulse.
filt1(1)
ans =
1.1250
% How did the state change?
state1()
ans =
1.1250 0.5625
% Make an averaging filter.
filt2 = makeFilter([1 1 1]/3, [1 0 0]);
% Put a step input into filt2.
filt2(1)
ans =
0.3333 filt2(1)
5-31

pageCatalog pdf di En 2012-06-22-01