How can i get a fixed value output after giving relatively close variable values

1 次查看(过去 30 天)
My demand is establishing a fixed value in SIMULINK.
Say input is 400,410,440,500,520,540,550 values. I want to get output is 500 value. What logic I have to use?

回答(1 个)

Pavel Osipov
Pavel Osipov 2019-10-5
Hi, everybody. Usually the method of "Half division"is used.
1. Build an input-output table, where the inputs are taken from [a, b] with a large step h, such that the outputs cover the point C=500. Narrow the interval [a, b] so that the response of the Simulink model to input a is less than 500, and the response of the model to input b is more than 500 .
2. Divide [a, b] in half:
d=(b-a)/2;
if the response of the model to the input is less than 500, then a will assign a value of B. otherwise, we will assign a value of B.
3. let's check if a solution to Your problem has been found:
abs (response(a) - response(b) ) < 500 (+/-)*eps, where eps-little.
for example, eps=1e-6;
4. With the new interval [a, b] we proceed as in paragraph 2.
The resulting cycle is performed until we get out of it according to claim 3.
This method is stable and simple, it is used very often.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by