Help with generating time-varying digital signal in simulink

Hey,
I am using simulink to describe a filter structure which I want to have 8 bits wide input to represent a word. I am for instance using Flip Flops from the Simulink Extras' library.
However, I want to generate an input signal to this filter and tried it using embedded matlab but I don't get it working. Most of the time I get errors complaining about the port widths and that there is a mismatch. I've not really used simulink before but what I am trying to do (and guess that I should do) is basically to generate an array of size [num_time_steps 8] and that every time slot output [1 8] to the input of my filter.
Can someone please send me a link to a simple example so that I understand how I can do this?
Or can I do it in another fashion?

Answers (1)

If you have the Communication Systems Toolbox, you may use the "Integer to Bit Converter" block. You just need to connect it to a "Random Number" block. If you don't, then you might be able to use the randint() or randi() function in MATLAB. Use the "MATLAB Fcn" block.

1 Comment

Thank you for your answer!
However, this implies that I want to input random numbers(?), which I don't. I want to input any kind of signal.
For now, I solved it by generating a matrix with time and values as rows and then saving this to a .mat-file. I then use that "From file"-block in simulink and output this to an embedded function that converts it to a binary valus. I guess I could do the last thing with the "Integer to Bit Converter"-block as suggested.

Sign in to comment.

Asked:

on 16 Jun 2011

Community Treasure Hunt

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

Start Hunting!