필터 지우기
필터 지우기

Simulink signal is double when it should be logical.

조회 수: 13 (최근 30일)
Samuel Kemp
Samuel Kemp 2022년 10월 22일
댓글: Samuel Kemp 2022년 10월 22일
I'm using a delay block to feed a signal back into a matlab function block. The signal is a logical. It is only ever set via true or false, I never use numbers. Simulink things this is a double for some reason, and I can't even change it to a single. I've tried setting the starting value in the delay block to false or logical(0), but neither work.

채택된 답변

Paul
Paul 2022년 10월 22일
Hi Sam,
Set the initial condition of the Delay block (or Unit Delay block, not sure which is being used) to false or true as desired.
In the Matlab Function block editor, click on Edit Data to open the Symbols pane. Ensure the input signal to the block that is the feedback from the Delay block has the Type explcitly set to Boolean (not Inheritied). This worked for me, with a Matlab Function block code being
function y = fcn(u)
y = ~u;
end
However, I don't understand why Matlab couldn't figure it all out once the IC of the delay block was specified as a Boolean.
  댓글 수: 1
Samuel Kemp
Samuel Kemp 2022년 10월 22일
Wow thank you so much! This was driving me insane, and I could not figure it out. I tried initial condition blocks and conversions, but nothing made it automatically realize it was a boolean.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by