linear optimization using optimization toolbox and minimize array sum

I had dataset of load for 7 days, 1min time interval and I want to put a threshold value. Now claculate a difference D=(load-Threshold) and this D array should be positive by taking modulus and then a array values 'V' with corresponding to the each load data to minimize the sum of array D all data. How to minimize the sum of all elements of D and find the array values of 'V'.
For example:
a = 30;
b = 150;
D = (b-a).*rand(100,1) + a; % load data
Th=110; % threshold
Diff= abs(D-TH);
Now I want to minimize the sum of "Diff" and find a corresponding vector V(100*1) vector for all values.

4 件のコメント

Torsten
Torsten 2019 年 7 月 31 日
Sorry, but I don't understand the general description of your problem.
Maybe a simple example can help to clarify.
MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
編集済み: MUKESH KUMAR 2019 年 7 月 31 日
Just take vector D(100*1) values between 50 to150 and there is one Threshold lets say 90 and I want to find out the positive differnece PD=abs(D-Th); and then minimize the sum of PD and find the values of vector V(100*1), after minimizin the sum of PD.
Thanks
Torsten
Torsten 2019 年 7 月 31 日
If you are given D and Th, then PD=abs(D-Th) is given. Then also the sum of PD is given. How do you want to minimize the sum of PD if it is already given ?
MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
Want vector V, for D+V-Th so the PD should be minimum

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

回答 (2 件)

Torsten
Torsten 2019 年 7 月 31 日

0 投票

https://math.stackexchange.com/questions/113270/the-median-minimizes-the-sum-of-absolute-deviations-the-l-1-norm
Bruno Luong
Bruno Luong 2019 年 7 月 31 日
編集済み: Bruno Luong 2019 年 7 月 31 日
Diff= abs(D-TH);
Now I want to minimize the sum of "Diff"
Threshold = median(D)

8 件のコメント

MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
Th is fix for all values and after calculating the Diff, its all values should be minimized and find Vector V(100*1) such that D+V-Th=0;
Bruno Luong
Bruno Luong 2019 年 7 月 31 日
Then
V = Th-D
Torsten
Torsten 2019 年 7 月 31 日
Th is known in advance ? Then how can you optimize anything if everything is fixed ?
MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
Want to find out V such that the sum of difference (D-Th) is minimum .
Bruno Luong
Bruno Luong 2019 年 7 月 31 日
Then my trivial solution meets that
V = Th-D
MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
if we neglect that D+V-Th=0 conditon then how can find V with minimizing Diff??
Bruno Luong
Bruno Luong 2019 年 7 月 31 日
Why do you neglect something that you want to achieve????
Wonder if you really know what you want.
MUKESH KUMAR
MUKESH KUMAR 2019 年 7 月 31 日
編集済み: MUKESH KUMAR 2019 年 7 月 31 日
Bcoz that constraint is by my misunderstanding and that is not a case in my original case
Thanks

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

カテゴリ

ヘルプ センター および File ExchangeGet Started with Optimization Toolbox についてさらに検索

質問済み:

2019 年 7 月 31 日

コメント済み:

2019 年 7 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by