How do I achieve downsampling using an MATLAB file S-function in Simulink 7.4 (R2009b)?

I am trying to create a block that takes in an input of varying sizes (512, 1024, 2048, etc.) and after scaling and processing, downsamples the input to produce only an integer fraction of the number of inputs. I have all the processing code, but I can't make the port dimensioning work. How do I do it ?

 Accepted Answer

For frame based inputs and outputs, the output port dimensions are dependent on the input port dimensions; therefore the outport dimensions must be set in SetInputPortDimensions callback function. The attached single-rate model "testMult.mdl" demonstrates this using the S-function in MATLAB file "MDownsample.m". The model takes in a signal of frame size 2048x1 and outputs a signal of frame size 8x1.

More Answers (0)

Products

Release

R2009b

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!