matlab中fmicon函数优化问题

刚开始学习优化,模仿论文做一个光伏储能优化配置问题,程序编写过程遇到困难。数学方程已经写出来,在截图里。
下面是我写的目标函数代码,不知道该怎么写上下限以及不等式约束,因为我学的例子都比较简单,这个题目简化后变量我感觉还是很多。
编程刚入门,想和大家一起进步。

function c_all = cost(x)%%定义目标函数
global PPV;
PPV=xlsread('用户负荷.xlsx','sheet1','B2:B6');
global Pdmd;
Pdmd=xlsread('用户负荷.xlsx','sheet1','C2:C6');
global Ce;
Ce=xlsread('电价.xlsx','sheet1','B2:B6');
global Csub;
Csub=xlsread('电价.xlsx','sheet1','C2');
global Csell;
Csell=xlsread('电价.xlsx','sheet1','D2');
global unitcost_battery_cap
unitcost_battery_cap=1000
global unitcost_battery_power
unitcost_battery_power=600
c_1=0;
for t=1:5
c_1=c_1-(x(t)+x(t+15)+x(t+10)).*Ce(t)+(x(t)+x(t+5)).*Csell;%五小时内购电花费,不带常量的
c_opex=c_1+Pdmd(t)*Ce-(Csell+Csub)*PPV(t)
end
c_all=(unitcost_battery_cap./0.9)*x(21)+unitcost_battery_power.*x(22)+c_1;%加上每日成本的总花费,不含常数项,
%方便利用coeffs提取系数,但还不会在外部调用函数提取数据
end

img

img

img

img

img