# linear optimization using optimization toolbox and minimize array sum

2 vues (au cours des 30 derniers jours)
MUKESH KUMAR le 31 Juil 2019
Commenté : MUKESH KUMAR le 31 Juil 2019
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 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Torsten le 31 Juil 2019
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 le 31 Juil 2019
Want vector V, for D+V-Th so the PD should be minimum

Connectez-vous pour commenter.

### Réponses (2)

Torsten le 31 Juil 2019
https://math.stackexchange.com/questions/113270/the-median-minimizes-the-sum-of-absolute-deviations-the-l-1-norm
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Bruno Luong le 31 Juil 2019
Modifié(e) : Bruno Luong le 31 Juil 2019
Diff= abs(D-TH);
Now I want to minimize the sum of "Diff"
Threshold = median(D)
##### 8 commentairesAfficher 6 commentaires plus anciensMasquer 6 commentaires plus anciens
Bruno Luong le 31 Juil 2019
Why do you neglect something that you want to achieve????
Wonder if you really know what you want.
MUKESH KUMAR le 31 Juil 2019
Modifié(e) : MUKESH KUMAR le 31 Juil 2019
Bcoz that constraint is by my misunderstanding and that is not a case in my original case
Thanks

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by