필터 지우기
필터 지우기

two inputs operation in an s function or embedded Matlab function

조회 수: 1 (최근 30일)
Owen
Owen 2012년 10월 16일
Hi,
an S function or Embedded Matlab function has two inputs with the same sample frequency and one output. Input1 is a data stream of integers, Input2 indicates how many elements from this sample point shall be output. The output has the same number of elements. The dimensions of inputs and output are all 1x1.
Example:
Input1: … 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 …
Input2: … 0 0 2 0 0 0 3 0 0 0 0 4 0 0 0 0 0 0 0 0 …
Output: …NaN NaN 3 4 NaN NaN 7 8 9 NaN NaN 12 13 14 15 NaN NaN NaN NaN NaN ...
How to implement this with the easiest way? What about logical and?
Thanks Senmeis
  댓글 수: 1
Mariano Lizarraga
Mariano Lizarraga 2012년 10월 16일
Senmeis, I think you need to clarify your question and your example a little bit more. If you say the inputs and outputs are all scalars, then if we take your example at sample time 3, then input1=3, input2=2 and I understand that output=3. So far so good, but at the next sample time, t=4, input1 = 4, input2=0 and I understand that you meant that the output be 4 because of input1 at t=3. But what happens if input2 instead of being 0 at t=4 is now not zero, say 4? Do you accumulate, do you discard the previous count? Also, having an output being NaN is not a good practice, you should probably reconsider your "No output" constant.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by