| 2 | 1/1 | 返回列表 |
| 查看: 283 | 回復(fù): 1 | |||
qiaoye32803新蟲(chóng) (初入文壇)
|
[求助]
函數(shù)調(diào)用
|
|
這是我的目標(biāo)函數(shù),里面有隨機(jī)生成數(shù): function opforpaper=lq_paper(x) syms theta; mu_ra=0.0645; mu_rb=0.0889; mu_rc=0.043; sigma_ra=0.008; sigma_rb=0.07; sigma_rc=0.004; for i=1:100 f_1(i)=cos(theta)*(x(1)+x(3)*normrnd(0,1)+normrnd(mu_rb,sigma_rb)*cos(unifrnd(0,2*pi))-normrnd(mu_ra,sigma_ra)*cos(unifrnd(0,2*pi)))+sqrt((x(2)+x(4)*normrnd(0,1)+normrnd(mu_rc,sigma_rc)*cos(unifrnd(0,2*pi))).^2-(x(1)+x(3)*normrnd(0,1)+normrnd(mu_rb,sigma_rb)*cos(unifrnd(0,2*pi))-normrnd(mu_ra,sigma_ra)*sin(theta)).^2); f_2(i)=cos(theta+0.0063)*(x(1)+x(3)*normrnd(0,1)+normrnd(mu_rb,sigma_rb)*cos(unifrnd(0,2*pi))-normrnd(mu_ra,sigma_ra)*cos(unifrnd(0,2*pi)))+sqrt((x(2)+x(4)*normrnd(0,1)+normrnd(mu_rc,sigma_rc)*cos(unifrnd(0,2*pi))).^2-(x(1)+x(3)*normrnd(0,1)+normrnd(mu_rb,sigma_rb)*cos(unifrnd(0,2*pi))-normrnd(mu_ra,sigma_ra)*sin(theta+0.0063)).^2); f3(i)=abs(f_1(i)-f_2(i)); end opforpaper=mean(f3); 下面的是約束, function [c,ceq]=consfun(x) M=384; c=[(M*sqrt(M^2+f3^2)-M)/(2*sqrt(M^2+f3^2))-0.05;f3*M/(2*sqrt(M^2+f3^2))-0.5]; ceq=[]; 下面的是所用的計(jì)算函數(shù): clear x0=[50,335,0.005,0.05]; lb=[45,330,0.002,0.007]; ub=[55,340,0.02,0.07]; options=optimset('largescale','off','Algorithm','active-set'); [x,fval]=fmincon('lq_paper',x0,[],[],[],[],lb,ub,'consfun',options) 現(xiàn)在有個(gè)問(wèn)題:在約束中的f3必須是目標(biāo)函數(shù)中生成的那個(gè)f3,因?yàn)槟繕?biāo)函數(shù)中的f3含有隨機(jī)數(shù),請(qǐng)問(wèn)哪位大神能幫我下,在約束中調(diào)用目標(biāo)函數(shù)中的那個(gè)f3! |
榮譽(yù)版主 (著名寫(xiě)手)
彩色掛圖
![]() |
專(zhuān)家經(jīng)驗(yàn): +2 |

| 2 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 307求調(diào)劑 +9 | 超級(jí)伊昂大王 2026-03-24 | 10/500 |
|
|---|---|---|---|---|
|
[考研] 總分293求調(diào)劑 +8 | 加一一九 2026-03-25 | 11/550 |
|
|
[考研] 070305高分子化學(xué)與物理 304分求調(diào)劑 +12 | c297914 2026-03-28 | 12/600 |
|
|
[考研] 291求調(diào)劑 +5 | Y-cap 2026-03-29 | 6/300 |
|
|
[考研] 一志愿鄭州大學(xué),080500學(xué)碩,總分317分求調(diào)劑 +8 | 舉個(gè)栗子oi 2026-03-24 | 9/450 |
|
|
[考研] 343求調(diào)劑 +6 | 愛(ài)羈絆 2026-03-29 | 6/300 |
|
|
[考研] 材料學(xué)碩333求調(diào)劑 +11 | 北道巷 2026-03-24 | 11/550 |
|
|
[考研] 數(shù)一英一271專(zhuān)碩(085401)求調(diào)劑,可跨 +7 | 前行必有光 2026-03-28 | 8/400 |
|
|
[考研] 一志愿太原理工安全工程300分,求調(diào)劑 +5 | 0857求調(diào)劑. 2026-03-24 | 6/300 |
|
|
[考研] 求化學(xué)調(diào)劑 +4 | wulanna 2026-03-28 | 4/200 |
|
|
[考研] 266分,求材料冶金能源化工等調(diào)劑 +7 | 哇呼哼呼哼 2026-03-27 | 9/450 |
|
|
[考研] 085701環(huán)境工程,267求調(diào)劑 +16 | minht 2026-03-26 | 16/800 |
|
|
[考研] 308求調(diào)劑 +7 | 墨墨漠 2026-03-27 | 7/350 |
|
|
[考研] 295求調(diào)劑 +5 | 1428151015 2026-03-27 | 6/300 |
|
|
[考研] 0703化學(xué)求調(diào)劑,各位老師看看我。! +5 | 祁祺祺 2026-03-25 | 5/250 |
|
|
[考研] 0703化學(xué)338求調(diào)劑! +6 | Zuhui0306 2026-03-26 | 7/350 |
|
|
[考研] 351求調(diào)劑 +4 | 麥克阿磊 2026-03-24 | 4/200 |
|
|
[考研] 一志愿 南京郵電大學(xué) 288分 材料考研 求調(diào)劑 +3 | jl0720 2026-03-26 | 3/150 |
|
|
[考研] 化工專(zhuān)碩求調(diào)劑 +3 | question挽風(fēng) 2026-03-24 | 3/150 |
|
|
[考研] 269求調(diào)劑 +4 | 我想讀研11 2026-03-23 | 4/200 |
|