How to sum the intervals in matlab

4 visualizaciones (últimos 30 días)
Krishma Gold
Krishma Gold el 11 de Sept. de 2019
Comentada: Krishma Gold el 14 de Sept. de 2019
Hi
I am struggling in writing the codes, that could generate the new value automatically. Grateful for any help
My scenario is as follows:
value Error interval interval no. new value
1000 0.5 [0,1] 3 1000*(1+(( 0+ 1)/2)/100)=1005
800 -1.7 [-2,-1] 1 800*(1+((-2+-1)/2)/100)= 788
.....
here the interval no., say we have 4, we have a list of errors that fall within these intervals
1 [-2, -1] 2 [-1, 0] 3 [0,1] 4[1,2]
my codes so far
v = [1000 800 2000 950 1500]
er = [0.5 -1.7 1.85 -0.25 0.8]
inter1 = [0; -2; 1; -1; 0]
inter2 = [1; -1; 2,; 0; 1]
cal = (1+((inter1+inter2)/2)/100)
nv = cal*v
the output is wrong
this method would be tedious for a many values.
Any help in this matter is highly appreciated.
Many thanks

Respuesta aceptada

Bruno Luong
Bruno Luong el 11 de Sept. de 2019
I have no idea what is the purpose and what is the problem, juste point out you might try
nv = cal.*v.'

Más respuestas (1)

dpb
dpb el 11 de Sept. de 2019
v=[1000;800]; err=[0.5;-1.7]; intvl=[0 1;-2 -1]; intvN=[3;1];
newv=v.*[1+mean(intvl,2)/100];
Above yields
>> newv
newv =
1.0e+03 *
1.0050
0.7880
>>

Categorías

Más información sobre Data Type Identification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by