필터 지우기
필터 지우기

Any possible block for adding a constant value to a particular element of a signal using if statement in simulink?

조회 수: 2 (최근 30일)
To a time series signal or event signal is there any possible block available for adding a constant value to a particular moment of time using if else block in simulink ?

채택된 답변

Birdman
Birdman 2017년 10월 31일
function y = SWITCH(Time,Value,Threshold)
y=0;
if(Time==Threshold)
y=Value;
else
y=0;
end
end
Firstly, see the simulink_model.png attachment. There is a model which I get a data from workspace, and a MATLAB Function which enables to add a specific value at a certain time. It has three inputs which are the clock of the simulation time, the value that you want to add, the time that you want the addition to happen. When you check the scope.png attachment, you will see that at 6th second, the value 2 has been added to the output. The MATLAB Function has the lines above. Hope this helps.
  댓글 수: 2
satheeshkumar satheeshkumar M
satheeshkumar satheeshkumar M 2017년 11월 1일
with respect to time your model is working well. can u give me a solution to add a constant if any value reaches the threshold in the signal in a particular moment?
Birdman
Birdman 2017년 11월 1일
Just change the Clock block with a continuous source, for instance a sine wave, and set the threshold value accordingly.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by