Quantcast
Channel: MATLAB Central Newsreader - tag:"variables"
Viewing all articles
Browse latest Browse all 41

Re: Creating a margin of error in a variable

$
0
0
On 7/20/2015 3:39 PM, Hannah Schultejans wrote:
> I have a variable called A, and I want to create a variable B that is
>essentially just A + or - 2. Is this possible?
>

There are called interval variables. Matlab's Mupad supports them. I do
not know if Matlab itself supports them or not since they need special
support. May be some special toolbox have them.

You can do this now in Matlab's mupad

--------------
a=10;
b=evalin(symengine, sprintf('Dom::Interval(%f, %f)',a-2,a+2))
---------------
      Dom::Interval(8.0, 12.0)

And now you can add and subtract from the interval.

>> b+0.1
Dom::Interval(8.1, 12.1)
  
>> b-2
Dom::Interval(6.0, 10.0)

You can also do arithmetic operations on set of interval variables.

Interval variable are important and used in robust control
(setting up a polynomial whose coefficients have some uncertainty
in their values within known ranges and then checking for stability
of the system over all ranges for example). Not easy problem.

--Nasser

Viewing all articles
Browse latest Browse all 41

Trending Articles