hi i have a function with 5 constraints , i need someone to help me write the 5th one
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi, am having an issue with a new constraint that was added to the code;
|Sk-Sk-1|>Delta SOCmin
Sk-Sk-1=dx
Sk-1-Sk=ds
DeltaSOCmin=0.2
For the first cosntraint of line 345 the code was performing normally,the problem is when adding this new constraint (line 349) the results are violation of constraint and the function F is returning Inf .The question is if it should be written another way or what are the changes that should be done to avoid violation , thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1424448/image.png)
0 Commenti
Risposte (1)
Divyajyoti Nayak
il 6 Lug 2023
Hi Anwar,
If your constraint is |S[k] - S[k-1]| > dSOCmin then the condition in the if statement should be
if any(abs(dx)<=dSOCmin | abs(ds)<=dSOCmin)
But this won't avoid the violation, as atleast one of the absolute values is less than dSOCmin.
I don't think the code is the problem but rather the values calculated in dx and ds.
2 Commenti
Divyajyoti Nayak
il 11 Lug 2023
Hey Anwar,
Could you give the code you are working with so that I may reproduce the issue at my end?
Vedere anche
Categorie
Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!