optimization for nonlinear equation using fminunc
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
i have an equation
. i have to do optimization for this to get unknown parameters z a and b.
,
and
are matrixes of size 364x441.after getting z a and b i have to put those values in above equation to get estimated LHS. how to do this using fminunc funtion in matlab
採用された回答
x0 = [1 1 1];
fun = @(x) x(1)*dsdt + x(2)*s.^x(3);
f = @(x) sum(sum((fun(x) - p).^2));
x = fminsearch(f,x0)
lhs = fun(x)
5 件のコメント
FATHIMA JAMSHEENA P
2023 年 7 月 10 日
after getting X matrix what should i do to get the Estimated p values? can i use those optimised x values directly to get estimated p values?
FATHIMA JAMSHEENA P
2023 年 7 月 10 日
and also before doing this do i have to define objective function
Torsten
2023 年 7 月 10 日
"f" is the objective function.
You have to supply dsdt, s and p.
FATHIMA JAMSHEENA P
2023 年 7 月 10 日
移動済み: Torsten
2023 年 7 月 10 日
s = load("s.mat");
s = s.s;
s = s(:);
size(s)
ans = 1×2
160524 1
idx = s > 0;
s = s(idx);
size(s)
ans = 1×2
160491 1
dsdt = load("dsdt.mat");
dsdt = dsdt.dsdt;
dsdt = dsdt(:);
dsdt = dsdt(idx);
p = load("p.mat");
p = p.p;
p = p(:);
p = p(idx);
x0 = [1 1 1];
fun = @(x) x(1)*dsdt + x(2)*s.^x(3);
f = @(x) sum((fun(x) - p).^2);
x = fminsearch(f,x0,optimset('MaxFunEvals',10000,'MaxIter',10000,'Display','iter'))
Iteration Func-count f(x) Procedure
0 1 1.20927e+07
1 4 1.20778e+07 initial simplex
2 6 1.20398e+07 expand
3 7 1.20398e+07 reflect
4 9 1.19714e+07 expand
5 11 1.18792e+07 expand
6 13 1.17615e+07 expand
7 15 1.13954e+07 expand
8 17 1.08876e+07 expand
9 19 1.07885e+07 reflect
10 21 1.07565e+07 contract outside
11 23 1.07565e+07 contract inside
12 25 1.07565e+07 contract outside
13 27 1.07565e+07 contract inside
14 28 1.07565e+07 reflect
15 30 1.07565e+07 contract inside
16 32 1.07565e+07 contract outside
17 34 1.07565e+07 contract inside
18 35 1.07565e+07 reflect
19 37 1.07501e+07 expand
20 39 1.07501e+07 contract inside
21 40 1.07501e+07 reflect
22 42 1.07501e+07 contract inside
23 43 1.07501e+07 reflect
24 44 1.07501e+07 reflect
25 46 1.07499e+07 reflect
26 48 1.07421e+07 expand
27 49 1.07421e+07 reflect
28 50 1.07421e+07 reflect
29 52 1.07395e+07 expand
30 54 1.07261e+07 expand
31 56 1.07178e+07 expand
32 57 1.07178e+07 reflect
33 59 1.06921e+07 expand
34 60 1.06921e+07 reflect
35 62 1.06768e+07 expand
36 64 1.06581e+07 expand
37 66 1.06415e+07 expand
38 68 1.06069e+07 expand
39 69 1.06069e+07 reflect
40 71 1.0574e+07 expand
41 73 1.0574e+07 contract inside
42 75 1.0574e+07 contract outside
43 76 1.0574e+07 reflect
44 78 1.05512e+07 expand
45 80 1.05512e+07 contract outside
46 81 1.05512e+07 reflect
47 83 1.05512e+07 contract inside
48 85 1.05496e+07 reflect
49 87 1.05453e+07 reflect
50 88 1.05453e+07 reflect
51 90 1.05421e+07 expand
52 92 1.05343e+07 expand
53 93 1.05343e+07 reflect
54 95 1.05308e+07 expand
55 97 1.05308e+07 contract inside
56 99 1.05308e+07 contract outside
57 100 1.05308e+07 reflect
58 101 1.05308e+07 reflect
59 103 1.05302e+07 contract inside
60 105 1.053e+07 reflect
61 107 1.053e+07 contract outside
62 109 1.053e+07 contract inside
63 111 1.05299e+07 reflect
64 113 1.05299e+07 contract inside
65 115 1.05299e+07 contract inside
66 117 1.05299e+07 contract inside
67 119 1.05299e+07 contract inside
68 121 1.05299e+07 contract inside
69 123 1.05299e+07 contract inside
70 125 1.05299e+07 reflect
71 127 1.05299e+07 reflect
72 128 1.05299e+07 reflect
73 130 1.05299e+07 contract inside
74 132 1.05299e+07 reflect
75 134 1.05299e+07 contract inside
76 136 1.05299e+07 contract inside
77 138 1.05298e+07 reflect
78 139 1.05298e+07 reflect
79 141 1.05298e+07 contract inside
80 143 1.05298e+07 expand
81 144 1.05298e+07 reflect
82 145 1.05298e+07 reflect
83 147 1.05298e+07 reflect
84 149 1.05298e+07 expand
85 151 1.05298e+07 contract outside
86 152 1.05298e+07 reflect
87 153 1.05298e+07 reflect
88 155 1.05298e+07 expand
89 156 1.05298e+07 reflect
90 157 1.05298e+07 reflect
91 159 1.05298e+07 expand
92 161 1.05297e+07 expand
93 163 1.05297e+07 expand
94 165 1.05296e+07 expand
95 166 1.05296e+07 reflect
96 168 1.05294e+07 expand
97 170 1.05292e+07 expand
98 171 1.05292e+07 reflect
99 173 1.05288e+07 expand
100 175 1.05283e+07 expand
101 176 1.05283e+07 reflect
102 178 1.05273e+07 expand
103 180 1.05264e+07 expand
104 182 1.05254e+07 expand
105 184 1.05251e+07 expand
106 186 1.0524e+07 reflect
107 187 1.0524e+07 reflect
108 189 1.0524e+07 contract inside
109 191 1.05222e+07 expand
110 192 1.05222e+07 reflect
111 194 1.0521e+07 expand
112 195 1.0521e+07 reflect
113 197 1.05167e+07 expand
114 198 1.05167e+07 reflect
115 200 1.05151e+07 expand
116 202 1.05063e+07 expand
117 203 1.05063e+07 reflect
118 204 1.05063e+07 reflect
119 206 1.05003e+07 expand
120 208 1.04913e+07 expand
121 210 1.04842e+07 reflect
122 212 1.04725e+07 expand
123 214 1.04549e+07 expand
124 215 1.04549e+07 reflect
125 217 1.04491e+07 reflect
126 219 1.04491e+07 contract inside
127 221 1.0444e+07 reflect
128 222 1.0444e+07 reflect
129 224 1.04438e+07 contract outside
130 226 1.0443e+07 contract inside
131 228 1.04426e+07 contract inside
132 230 1.0442e+07 contract inside
133 232 1.0442e+07 contract outside
134 234 1.0442e+07 contract inside
135 236 1.0442e+07 contract inside
136 238 1.04419e+07 reflect
137 240 1.04419e+07 reflect
138 242 1.04418e+07 contract inside
139 244 1.04417e+07 expand
140 245 1.04417e+07 reflect
141 247 1.04417e+07 contract outside
142 249 1.04413e+07 expand
143 250 1.04413e+07 reflect
144 251 1.04413e+07 reflect
145 253 1.04406e+07 expand
146 254 1.04406e+07 reflect
147 256 1.04402e+07 expand
148 258 1.04396e+07 expand
149 260 1.04379e+07 expand
150 261 1.04379e+07 reflect
151 263 1.04377e+07 reflect
152 265 1.04363e+07 expand
153 267 1.0435e+07 expand
154 269 1.0435e+07 contract inside
155 271 1.04348e+07 reflect
156 273 1.04348e+07 contract inside
157 275 1.04341e+07 reflect
158 277 1.04341e+07 contract inside
159 279 1.04339e+07 expand
160 280 1.04339e+07 reflect
161 282 1.04339e+07 contract inside
162 284 1.04339e+07 contract outside
163 285 1.04339e+07 reflect
164 287 1.04338e+07 reflect
165 289 1.04338e+07 contract inside
166 291 1.04338e+07 reflect
167 293 1.04338e+07 contract outside
168 294 1.04338e+07 reflect
169 296 1.04338e+07 contract inside
170 298 1.04338e+07 contract inside
171 300 1.04338e+07 contract inside
172 302 1.04338e+07 contract inside
173 303 1.04338e+07 reflect
174 305 1.04338e+07 contract outside
175 306 1.04338e+07 reflect
176 308 1.04338e+07 contract inside
177 310 1.04338e+07 contract inside
178 312 1.04338e+07 contract inside
179 314 1.04338e+07 contract inside
180 316 1.04338e+07 contract inside
181 318 1.04338e+07 contract inside
182 320 1.04338e+07 reflect
183 322 1.04338e+07 contract inside
184 323 1.04338e+07 reflect
185 325 1.04338e+07 contract inside
186 326 1.04338e+07 reflect
187 328 1.04338e+07 contract inside
188 330 1.04338e+07 contract inside
189 332 1.04338e+07 expand
190 333 1.04338e+07 reflect
191 335 1.04338e+07 contract inside
192 336 1.04338e+07 reflect
193 338 1.04338e+07 contract inside
194 340 1.04338e+07 contract outside
195 342 1.04338e+07 contract inside
196 344 1.04338e+07 reflect
197 346 1.04338e+07 contract inside
198 348 1.04338e+07 contract inside
199 350 1.04338e+07 contract inside
200 352 1.04338e+07 contract inside
201 354 1.04338e+07 contract inside
202 356 1.04338e+07 contract inside
203 358 1.04338e+07 contract inside
204 360 1.04338e+07 contract inside
205 362 1.04338e+07 contract inside
206 363 1.04338e+07 reflect
207 364 1.04338e+07 reflect
208 366 1.04338e+07 contract outside
209 368 1.04338e+07 contract inside
210 370 1.04338e+07 contract inside
211 371 1.04338e+07 reflect
212 372 1.04338e+07 reflect
213 374 1.04338e+07 contract inside
214 376 1.04338e+07 contract outside
215 378 1.04338e+07 contract inside
216 380 1.04338e+07 contract inside
217 382 1.04338e+07 contract outside
218 384 1.04338e+07 contract inside
219 385 1.04338e+07 reflect
220 387 1.04338e+07 contract inside
221 389 1.04338e+07 contract outside
222 391 1.04338e+07 contract outside
223 393 1.04338e+07 contract inside
224 395 1.04338e+07 contract outside
225 397 1.04338e+07 contract inside
226 398 1.04338e+07 reflect
227 400 1.04338e+07 contract inside
228 402 1.04338e+07 contract inside
229 404 1.04338e+07 contract outside
Optimization terminated:
the current x satisfies the termination criteria using OPTIONS.TolX of 1.000000e-04
and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 1.000000e-04
x = 1×3
111.0799 29.1041 1.7976
f(x)
ans = 1.0434e+07
lhs = fun(x)
lhs = 160491×1
2.9934
3.3399
3.1968
3.2387
3.2808
3.3120
3.3416
3.3916
3.4217
3.4499
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
