MATLAB Answers

0

How to sum the intervals in matlab

Asked by Krishma Gold on 11 Sep 2019
Latest activity Commented on by Krishma Gold on 14 Sep 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

  0 Comments

Sign in to comment.

2 Answers

Answer by Bruno Luong
on 11 Sep 2019
 Accepted Answer

I have no idea what is the purpose and what is the problem, juste point out you might try
nv = cal.*v.'

  1 Comment

thank you

Sign in to comment.


dpb
Answer by dpb
on 11 Sep 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
>>

  1 Comment

thank you

Sign in to comment.