| 1 | 1/1 | 返回列表 |
| 查看: 394 | 回復(fù): 0 | ||
ws89金蟲 (著名寫手)
悠然書生
|
[求助]
參數(shù)擬合程序,不知道是不是陷入了死循環(huán),運(yùn)行兩天還在跑。求幫助
|
|
參數(shù)擬合程序,不知道是不是陷入了死循環(huán),運(yùn)行兩天還在跑。師兄的程序,沒有得到最后跟師兄一致的結(jié)果。求幫助。大神給看看是怎磨回事。 clc clear allT2=[-20 -10 -10 0 0 0 0 10 10 20]'; allf=1.0e+003 *[2.1304 0.9212 0.9212 0.4141 0.4141 0.4141 0.4141 0.193 0.193 0.093]'; allw2=[1 1 2 0.1 0.5 1 5 1 2 1]'; allG2=[23.46 8.062 14 1 2.97 4.18 13.483 2.13 3.128 1.08]'*10^6; allG1=[17 5.8 10 2.5 3.3 3.8 9.7 3.0 3.4 2.7]'*10^6; for i=1:10 f2(i,1)=allf(i); w2(i,1)=allw2(i); G1(i,1)=allG1(i); G2(i,1)=allG2(i); end x1=[f2 w2]; GG2=@(p,x)(p(1).*p(2).^2./p(4).^2+2.*p(1).*p(2)./p(4).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*p(5))+p(1).*x1(:,1).^(2.*p(5)).*x1(:,2).^(2.*p(5))+p(3).*p(2).^2./p(4)^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*cos... (pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*cos(pi/2.*p(5)).*cos(pi/2.*p(7))+p(3).*x1(:,1).^(2.*p(5)+p(7)).*x1(:,2).^(2.*p(5)+p(7)).*cos(pi/2.*p(7))+p(2).^2.... ./p(4).*cos(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*(p(5)+p(6)))); GG1=@(p,x)(p(3).*p(2).^2./p(4).^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*sin(pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*sin(pi/2.*p(5)).*sin(pi/2.*p(7))+p(3).*x1(:,1).^... (2.*p(5)+p(7)).*x1(:,2).^(2*p(5)+p(7)).*sin(pi/2.*p(7))+p(2).^2./p(4).*sin(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*sin(pi/2.*(p(5)+p(6)))); p0=[97.06669468363,272.111066749,60321.3626849,164.3298821730,0.517346991136036,0.20053385863749,0.26009044292186]; p=p0; GG22=p(1).*p(2).^2./p(4).^2+2.*p(1).*p(2)./p(4).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*p(5))+p(1).*x1(:,1).^(2.*p(5)).*x1(:,2).^(2.*p(5))+p(3).*p(2).^2./p(4)^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*cos... (pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*cos(pi/2.*p(5)).*cos(pi/2.*p(7))+p(3).*x1(:,1).^(2.*p(5)+p(7)).*x1(:,2).^(2.*p(5)+p(7)).*cos(pi/2.*p(7))+p(2).^2.... ./p(4).*cos(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*(p(5)+p(6))); %p0=p; GG11=p(3).*p(2).^2./p(4).^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*sin(pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*sin(pi/2.*p(5)).*sin(pi/2.*p(7))+p(3).*x1(:,1).^... (2.*p(5)+p(7)).*x1(:,2).^(2*p(5)+p(7)).*sin(pi/2.*p(7))+p(2).^2./p(4).*sin(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*sin(pi/2.*(p(5)+p(6))); a1=0.5;a2=1-a1; while(1) if (norm(GG11-allG1,inf)<1.0e6&&norm(GG22-allG2,inf)<1.0e6) break end options = optimset('MaxFunEvals',4000,'MaxIter',40000); p=fminsearch(@(p)(a1*(sum(((G1-GG1(p,x1))./G1).^2)+a2*sum(((G2-GG2(p,x1))./G2).^2))),p0); GG22=p(1).*p(2).^2./p(4).^2+2.*p(1).*p(2)./p(4).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*p(5))+p(1).*x1(:,1).^(2.*p(5)).*x1(:,2).^(2.*p(5))+p(3).*p(2).^2./p(4)^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*cos... (pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*cos(pi/2.*p(5)).*cos(pi/2.*p(7))+p(3).*x1(:,1).^(2.*p(5)+p(7)).*x1(:,2).^(2.*p(5)+p(7)).*cos(pi/2.*p(7))+p(2).^2.... ./p(4).*cos(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*cos(pi/2.*(p(5)+p(6))); GG11=p(3).*p(2).^2./p(4).^2.*x1(:,1).^p(7).*x1(:,2).^p(7).*sin(pi/2.*p(7))+2.*p(3).*p(2)./p(4).*x1(:,1).^(p(5)+p(7)).*x1(:,2).^(p(5)+p(7)).*sin(pi/2.*p(5)).*sin(pi/2.*p(7))+p(3).*x1(:,1).^... (2.*p(5)+p(7)).*x1(:,2).^(2*p(5)+p(7)).*sin(pi/2.*p(7))+p(2).^2./p(4).*sin(pi/2.*p(6))+p(2).*x1(:,1).^p(5).*x1(:,2).^p(5).*sin(pi/2.*(p(5)+p(6))); p0=p; end |

| 1 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 288求調(diào)劑 +7 | 于海海海海 2026-03-19 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 一志愿北京化工大學(xué)0703化學(xué)318分,有科研經(jīng)歷,求調(diào)劑 +3 | 一瓶苯甲酸 2026-03-14 | 3/150 |
|
|
[考研] 307求調(diào)劑 +6 | 冷笙123 2026-03-17 | 6/300 |
|
|
[考研] 材料專碩274一志愿陜西師范大學(xué)求調(diào)劑 +7 | 薛云鵬 2026-03-13 | 7/350 |
|
|
[考研] 一志愿南昌大學(xué),327分,材料與化工085600 +3 | Ncdx123456 2026-03-19 | 3/150 |
|
|
[考研] 287求調(diào)劑 +3 | 晨昏線與星海 2026-03-19 | 4/200 |
|
|
[考研] 一志愿武漢理工材料工程專碩調(diào)劑 +3 | Doleres 2026-03-19 | 3/150 |
|
|
[考研] 281求調(diào)劑(0805) +9 | 煙汐憶海 2026-03-16 | 19/950 |
|
|
[考研] 328求調(diào)劑,英語六級(jí)551,有科研經(jīng)歷 +4 | 生物工程調(diào)劑 2026-03-16 | 12/600 |
|
|
[考研] 0703化學(xué) 305求調(diào)劑 +4 | FY_yy 2026-03-14 | 4/200 |
|
|
[考研] 08工科 320總分 求調(diào)劑 +5 | 梨花珞晚風(fēng) 2026-03-17 | 5/250 |
|
|
[考研] 297求調(diào)劑 +8 | 戲精丹丹丹 2026-03-17 | 8/400 |
|
|
[考博] 環(huán)境領(lǐng)域全國重點(diǎn)實(shí)驗(yàn)室招收博士1-2名 +3 | QGZDSYS 2026-03-13 | 5/250 |
|
|
[考研] 326求調(diào)劑 +5 | 上岸的小葡 2026-03-15 | 6/300 |
|
|
[考研] 326求調(diào)劑 +4 | 諾貝爾化學(xué)獎(jiǎng)覬?/a> 2026-03-15 | 7/350 |
|
|
[基金申請]
今年的國基金是打分制嗎?
50+3
|
zhanghaozhu 2026-03-14 | 3/150 |
|
|
[考研] 085601材料工程315分求調(diào)劑 +3 | yang_0104 2026-03-15 | 3/150 |
|
|
[考研] 中科大材料與化工319求調(diào)劑 +3 | 孟鑫材料 2026-03-14 | 3/150 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 081200-11408-276學(xué)碩求調(diào)劑 +3 | 崔wj 2026-03-12 | 4/200 |
|