How to sum the intervals in matlab

4 ビュー (過去 30 日間)
Krishma Gold
Krishma Gold 2019 年 9 月 11 日
コメント済み: Krishma Gold 2019 年 9 月 14 日
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

採用された回答

Bruno Luong
Bruno Luong 2019 年 9 月 11 日
I have no idea what is the purpose and what is the problem, juste point out you might try
nv = cal.*v.'
  1 件のコメント
Krishma Gold
Krishma Gold 2019 年 9 月 14 日
thank you

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2019 年 9 月 11 日
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 件のコメント
Krishma Gold
Krishma Gold 2019 年 9 月 14 日
thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by