How can I set no initial value for the unit delay block ??
6 次查看(过去 30 天)
显示 更早的评论
Hello, Im trying to make a simulink model for a project have. What Im trying to do is to control the values from sxitch2 based on the values imported from switch1, the function in the block has the following code:
function y =rounding(x)
mintol=0.5;
if abs(x)<mintol
y=0;
else
y=x;
end
end
What I have noticed is that the time delay blocks initial value is zero "0" thus every new value that enters gets set to zero. Thus not able to lock the switch. I have tried to remove the unit block but I get the following error message:
"Simulink cannot solve the algebraic loop containing 'test/MATLAB Function2' at time 0.0 using the TrustRegion-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues. To rule out solver convergence as the cause of this error, either
- switch to LineSearch-based algorithm usingset_param('test','AlgebraicLoopSolver','LineSearch')
- reducing the VariableStepDiscrete solver RelTol parameter so that the solver takes smaller time steps.If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification."
0 个评论
采纳的回答
A Jenkins
2014-1-6
You must have an initial value for switch2 so that it knows which of the [111] or [000] to start with. Therefore you must have an initial result of your AND block, and an initial value of your unit delay blocks. (You could move and combine the unit delay right before your switch2 if that helps you think about it.)
That said, your values are not flip-flopping because of your initial value. Imagine you initially start with the switch2 "on" so that [111] is fed forward. Then since [111] is not equal to 0, the result of the AND will be 0 and your switch will turn "off", and select [000] next time. Then [000] is equal to 0 so result of the AND will be 1 and your switch will turn back "on" and select [111].
Perhaps you should explain what you are trying to do. Also, you might want to look into the latches and flip-flop blocks.
0 个评论
更多回答(3 个)
Azzi Abdelmalek
2014-1-6
I'am not following you, the initial value of the unit delay block is used, only at the start of your simulation, and you can set it to whatever you want.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!