MATLAB Answers

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

2 views (last 30 days)
habib arnab
habib arnab on 5 Oct 2019
Answered: Pavel Osipov on 5 Oct 2019
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 Comment

Daniel M
Daniel M on 5 Oct 2019
Since you have given no constraints this is trivial:
output = 500;
But perhaps you would like to explain your problem a little more clearer.

Sign in to comment.

Answers (1)

Pavel Osipov
Pavel Osipov on 5 Oct 2019
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:
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.


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by