diff --git a/Claudio_Maggioni_2/Claudio_Maggioni_2.pdf b/Claudio_Maggioni_2/Claudio_Maggioni_2.pdf index 4a61d6c..5185e2c 100644 Binary files a/Claudio_Maggioni_2/Claudio_Maggioni_2.pdf and b/Claudio_Maggioni_2/Claudio_Maggioni_2.pdf differ diff --git a/Claudio_Maggioni_2/Claudio_Maggioni_2.tex b/Claudio_Maggioni_2/Claudio_Maggioni_2.tex index 3c0bba5..f90920f 100755 --- a/Claudio_Maggioni_2/Claudio_Maggioni_2.tex +++ b/Claudio_Maggioni_2/Claudio_Maggioni_2.tex @@ -1,5 +1,6 @@ \documentclass{scrartcl} \usepackage[utf8]{inputenc} +\usepackage{float} \usepackage{graphicx} \usepackage{subcaption} \usepackage{amsmath} @@ -72,6 +73,18 @@ use semilogy) as functions of the iterations.} The solution of this task can be found in Section 1.5 of the script \texttt{main.m}. +\begin{figure}[H] + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{\textwidth}{\input{obvalues}} + \caption{Objective function values w.r.t. iteration number} + \end{subfigure} + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{\textwidth}{\input{gnorms}} + \caption{Norm of the gradient w.r.t. iteration number \\ (y-axis is log scaled)} + \end{subfigure} + \caption{Plots for Exercise 1.4.} +\end{figure} + \subsection{Finally, explain why the Conjugate Gradient method is a Krylov subspace method.} Because theorem 5.3 holds, which itself holds mainly because of this (5.10, page 106 [127]): @@ -104,6 +117,26 @@ and plot it with respect to the number of iteration.} The solution of this task can be found in section 2.3 of the \texttt{main.m} MATLAB script. +\begin{figure}[H] + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{!}{\input{a1}} + \caption{First matrix} + \end{subfigure} + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{!}{\input{a2}} + \caption{Second matrix} + \end{subfigure} + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{!}{\input{a3}} + \caption{Third matrix} + \end{subfigure} + \begin{subfigure}{0.5\textwidth} + \resizebox{\textwidth}{!}{\input{a4}} + \caption{Fourth matrix} + \end{subfigure} + \caption{Plots of logarithm energy norm of the error per iteration. Minus infinity logarithms not shown in the plot.} +\end{figure} + \subsection{Comment on the convergence of the method for the different matrices. What can you say observing the number of iterations obtained and the number of clusters of the eigenvalues of the related matrix?} diff --git a/Claudio_Maggioni_2/a1.tex b/Claudio_Maggioni_2/a1.tex new file mode 100644 index 0000000..e0a8cf6 --- /dev/null +++ b/Claudio_Maggioni_2/a1.tex @@ -0,0 +1,32 @@ +% This file was created by matlab2tikz. +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +unbounded coords=jump, +xmin=-1, +xmax=11, +ymin=-35, +ymax=2, +axis background/.style={fill=white} +] +\addplot [color=black, mark=*, mark options={solid, black}, forget plot] + table[row sep=crcr]{% +0 0.47805830470258\\ +1 -0.302580121524669\\ +2 -1.39791624910794\\ +3 -2.56715639075687\\ +4 -3.69859649313088\\ +5 -5.18451648631276\\ +6 -7.47482224276235\\ +7 -11.0156865949418\\ +8 -13.5280651039553\\ +9 -17.307632058672\\ +10 -inf\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file diff --git a/Claudio_Maggioni_2/a2.tex b/Claudio_Maggioni_2/a2.tex new file mode 100644 index 0000000..ad203fc --- /dev/null +++ b/Claudio_Maggioni_2/a2.tex @@ -0,0 +1,23 @@ +% This file was created by matlab2tikz. +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +unbounded coords=jump, +xmin=-1, +xmax=11, +ymin=-35, +ymax=2, +axis background/.style={fill=white} +] +\addplot [color=black, mark=*, mark options={solid, black}, forget plot] + table[row sep=crcr]{% +0 1.60311336470871\\ +1 -inf\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file diff --git a/Claudio_Maggioni_2/a3.tex b/Claudio_Maggioni_2/a3.tex new file mode 100644 index 0000000..e193719 --- /dev/null +++ b/Claudio_Maggioni_2/a3.tex @@ -0,0 +1,27 @@ +% This file was created by matlab2tikz. +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +unbounded coords=jump, +xmin=-1, +xmax=11, +ymin=-35, +ymax=2, +axis background/.style={fill=white} +] +\addplot [color=black, mark=*, mark options={solid, black}, forget plot] + table[row sep=crcr]{% +0 0.761005788008382\\ +1 0.175131370307115\\ +2 -0.895425635095078\\ +3 -3.07519833588777\\ +4 -6.90756348665296\\ +5 -inf\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file diff --git a/Claudio_Maggioni_2/a4.tex b/Claudio_Maggioni_2/a4.tex new file mode 100644 index 0000000..8fbdfb3 --- /dev/null +++ b/Claudio_Maggioni_2/a4.tex @@ -0,0 +1,31 @@ +% This file was created by matlab2tikz. +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +unbounded coords=jump, +xmin=-1, +xmax=11, +ymin=-35, +ymax=2, +axis background/.style={fill=white} +] +\addplot [color=black, mark=*, mark options={solid, black}, forget plot] + table[row sep=crcr]{% +0 1.20231179447017\\ +1 -1.83226396109046\\ +2 -5.71516331372262\\ +3 -9.4737370445464\\ +4 -13.1531086466742\\ +5 -17.1786161833937\\ +6 -21.6665209383152\\ +7 -27.3164913486317\\ +8 -32.1088826096102\\ +9 -inf\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file diff --git a/Claudio_Maggioni_2/gnorms.tex b/Claudio_Maggioni_2/gnorms.tex new file mode 100644 index 0000000..7bf9ef2 --- /dev/null +++ b/Claudio_Maggioni_2/gnorms.tex @@ -0,0 +1,522 @@ +% This file was created by matlab2tikz. +% +\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}% +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +xmin=-1, +xmax=500, +ymode=log, +yminorticks=true, +axis background/.style={fill=white} +] +\addplot [color=mycolor1, forget plot] + table[row sep=crcr]{% +0 3.1654415173795e-05\\ +1 0.0157797180267188\\ +2 0.0157322760591951\\ +3 0.015684881732118\\ +4 0.0156375350934236\\ +5 0.0155902361911929\\ +6 0.0155429850736525\\ +7 0.0154957817891757\\ +8 0.0154486263862827\\ +9 0.015401518913642\\ +10 0.0153544594200704\\ +11 0.0153074479545346\\ +12 0.0152604845661512\\ +13 0.0152135693041879\\ +14 0.0151667022180643\\ +15 0.0151198833573523\\ +16 0.0150731127717775\\ +17 0.0150263905112192\\ +18 0.0149797166257119\\ +19 0.0149330911654459\\ +20 0.0148865141807679\\ +21 0.0148399857221819\\ +22 0.0147935058403503\\ +23 0.0147470745860942\\ +24 0.014700692010395\\ +25 0.0146543581643943\\ +26 0.0146080730993955\\ +27 0.0145618368668644\\ +28 0.0145156495184298\\ +29 0.0144695111058849\\ +30 0.0144234216811875\\ +31 0.0143773812964618\\ +32 0.0143313900039983\\ +33 0.0142854478562552\\ +34 0.0142395549058595\\ +35 0.014193711205607\\ +36 0.0141479168084645\\ +37 0.0141021717675699\\ +38 0.0140564761362333\\ +39 0.0140108299679372\\ +40 0.0139652333163394\\ +41 0.0139196862352715\\ +42 0.0138741887787422\\ +43 0.013828741000936\\ +44 0.0137833429562163\\ +45 0.0137379946991244\\ +46 0.0136926962843823\\ +47 0.0136474477668921\\ +48 0.0136022492017384\\ +49 0.013557100644188\\ +50 0.0135120021496921\\ +51 0.0134669537738862\\ +52 0.0134219555725925\\ +53 0.0133770076018191\\ +54 0.0133321099177632\\ +55 0.01328726257681\\ +56 0.0132424656355356\\ +57 0.0131977191507067\\ +58 0.0131530231792828\\ +59 0.013108377778416\\ +60 0.0130637830054538\\ +61 0.0130192389179382\\ +62 0.0129747455736087\\ +63 0.012930303030402\\ +64 0.0128859113464542\\ +65 0.0128415705801008\\ +66 0.0127972807898792\\ +67 0.0127530420345284\\ +68 0.0127088543729918\\ +69 0.0126647178644173\\ +70 0.0126206325681578\\ +71 0.0125765985437747\\ +72 0.0125326158510353\\ +73 0.0124886845499201\\ +74 0.0124448047006168\\ +75 0.0124009763635278\\ +76 0.0123571995992663\\ +77 0.0123134744686614\\ +78 0.0122698010327579\\ +79 0.012226179352818\\ +80 0.0121826094903207\\ +81 0.0121390915069656\\ +82 0.0120956254646736\\ +83 0.0120522114255878\\ +84 0.0120088494520737\\ +85 0.0119655396067225\\ +86 0.0119222819523521\\ +87 0.0118790765520081\\ +88 0.0118359234689638\\ +89 0.0117928227667239\\ +90 0.0117497745090249\\ +91 0.0117067787598372\\ +92 0.011663835583364\\ +93 0.0116209450440459\\ +94 0.011578107206561\\ +95 0.0115353221358268\\ +96 0.0114925898969997\\ +97 0.0114499105554792\\ +98 0.0114072841769085\\ +99 0.011364710827176\\ +100 0.0113221905724149\\ +101 0.0112797234790075\\ +102 0.0112373096135872\\ +103 0.0111949490430363\\ +104 0.0111526418344911\\ +105 0.0111103880553406\\ +106 0.0110681877732329\\ +107 0.0110260410560709\\ +108 0.0109839479720182\\ +109 0.0109419085894973\\ +110 0.0108999229771967\\ +111 0.010857991204066\\ +112 0.0108161133393225\\ +113 0.0107742894524492\\ +114 0.0107325196132016\\ +115 0.0106908038916034\\ +116 0.0106491423579531\\ +117 0.0106075350828215\\ +118 0.0105659821370593\\ +119 0.0105244835917926\\ +120 0.0104830395184291\\ +121 0.0104416499886565\\ +122 0.0104003150744496\\ +123 0.0103590348480659\\ +124 0.0103178093820521\\ +125 0.0102766387492424\\ +126 0.0102355230227656\\ +127 0.0101944622760411\\ +128 0.0101534565827851\\ +129 0.0101125060170093\\ +130 0.0100716106530278\\ +131 0.0100307705654531\\ +132 0.00998998582920282\\ +133 0.00994925651949814\\ +134 0.00990858271187067\\ +135 0.00986796448215906\\ +136 0.00982740190651517\\ +137 0.0097868950614029\\ +138 0.00974644402360517\\ +139 0.00970604887022049\\ +140 0.00966570967866934\\ +141 0.00962542652669294\\ +142 0.00958519949236043\\ +143 0.00954502865406551\\ +144 0.00950491409053283\\ +145 0.00946485588081696\\ +146 0.00942485410430954\\ +147 0.00938490884073612\\ +148 0.00934502017016165\\ +149 0.0093051881729941\\ +150 0.00926541292998292\\ +151 0.00922569452222382\\ +152 0.00918603303116333\\ +153 0.00914642853859694\\ +154 0.0091068811266738\\ +155 0.00906739087790145\\ +156 0.00902795787514411\\ +157 0.00898858220162735\\ +158 0.00894926394094302\\ +159 0.00891000317704674\\ +160 0.00887079999426647\\ +161 0.00883165447730008\\ +162 0.00879256671122033\\ +163 0.00875353678147975\\ +164 0.00871456477390919\\ +165 0.00867565077472273\\ +166 0.00863679487052276\\ +167 0.00859799714829781\\ +168 0.00855925769543122\\ +169 0.00852057659969908\\ +170 0.00848195394927536\\ +171 0.00844338983273706\\ +172 0.00840488433906299\\ +173 0.00836643755763896\\ +174 0.00832804957826307\\ +175 0.00828972049114384\\ +176 0.00825145038690911\\ +177 0.00821323935660422\\ +178 0.00817508749169748\\ +179 0.00813699488408549\\ +180 0.00809896162609229\\ +181 0.00806098781047477\\ +182 0.00802307353042824\\ +183 0.00798521887958488\\ +184 0.00794742395202286\\ +185 0.00790968884226493\\ +186 0.00787201364528408\\ +187 0.00783439845650918\\ +188 0.00779684337182447\\ +189 0.0077593484875753\\ +190 0.00772191390057391\\ +191 0.00768453970809832\\ +192 0.00764722600790168\\ +193 0.00760997289821125\\ +194 0.00757278047773439\\ +195 0.00753564884566447\\ +196 0.00749857810168078\\ +197 0.0074615683459546\\ +198 0.00742461967915527\\ +199 0.00738773220244956\\ +200 0.00735090601751125\\ +201 0.00731414122652058\\ +202 0.00727743793217055\\ +203 0.00724079623767324\\ +204 0.00720421624675944\\ +205 0.00716769806368845\\ +206 0.00713124179324783\\ +207 0.00709484754075991\\ +208 0.00705851541208838\\ +209 0.0070222455136389\\ +210 0.00698603795236574\\ +211 0.00694989283577857\\ +212 0.00691381027194255\\ +213 0.0068777903694885\\ +214 0.00684183323761315\\ +215 0.00680593898608611\\ +216 0.00677010772525691\\ +217 0.00673433956605603\\ +218 0.00669863462000215\\ +219 0.00666299299920925\\ +220 0.00662741481638734\\ +221 0.00659190018485302\\ +222 0.00655644921853034\\ +223 0.00652106203195822\\ +224 0.00648573874029798\\ +225 0.00645047945933504\\ +226 0.00641528430548656\\ +227 0.00638015339580917\\ +228 0.00634508684800024\\ +229 0.00631008478040902\\ +230 0.00627514731203806\\ +231 0.00624027456255124\\ +232 0.00620546665228187\\ +233 0.00617072370223502\\ +234 0.00613604583409576\\ +235 0.0061014331702375\\ +236 0.006066885833724\\ +237 0.00603240394832098\\ +238 0.00599798763849837\\ +239 0.00596363702943893\\ +240 0.00592935224704701\\ +241 0.00589513341795163\\ +242 0.00586098066951542\\ +243 0.00582689412984363\\ +244 0.00579287392778691\\ +245 0.00575892019295364\\ +246 0.00572503305571297\\ +247 0.00569121264720421\\ +248 0.00565745909934627\\ +249 0.00562377254484168\\ +250 0.00559015311718629\\ +251 0.00555660095067903\\ +252 0.00552311618042564\\ +253 0.00548969894235178\\ +254 0.00545634937320699\\ +255 0.00542306761057491\\ +256 0.00538985379288368\\ +257 0.00535670805940993\\ +258 0.00532363055029368\\ +259 0.00529062140654112\\ +260 0.00525768077003668\\ +261 0.0052248087835537\\ +262 0.00519200559076005\\ +263 0.00515927133622939\\ +264 0.00512660616545254\\ +265 0.00509401022484292\\ +266 0.00506148366175127\\ +267 0.00502902662447137\\ +268 0.00499663926225206\\ +269 0.00496432172530924\\ +270 0.00493207416483222\\ +271 0.00489989673299904\\ +272 0.0048677895829831\\ +273 0.00483575286896589\\ +274 0.00480378674614987\\ +275 0.00477189137076559\\ +276 0.00474006690008788\\ +277 0.00470831349244334\\ +278 0.00467663130722396\\ +279 0.00464502050490086\\ +280 0.00461348124703293\\ +281 0.00458201369628163\\ +282 0.00455061801642291\\ +283 0.0045192943723595\\ +284 0.00448804293013615\\ +285 0.0044568638569488\\ +286 0.00442575732116265\\ +287 0.00439472349232172\\ +288 0.00436376254116446\\ +289 0.00433287463963956\\ +290 0.00430205996091684\\ +291 0.00427131867940353\\ +292 0.00424065097076077\\ +293 0.0042100570119147\\ +294 0.00417953698107631\\ +295 0.00414909105775303\\ +296 0.00411871942276631\\ +297 0.00408842225826936\\ +298 0.00405819974775964\\ +299 0.0040280520761\\ +300 0.00399797942953172\\ +301 0.00396798199569348\\ +302 0.00393805996364055\\ +303 0.00390821352385935\\ +304 0.0038784428682873\\ +305 0.00384874819033299\\ +306 0.00381912968489116\\ +307 0.00378958754836631\\ +308 0.00376012197868838\\ +309 0.00373073317533429\\ +310 0.00370142133934982\\ +311 0.00367218667336645\\ +312 0.00364302938162671\\ +313 0.00361394967000176\\ +314 0.00358494774601489\\ +315 0.00355602381886526\\ +316 0.00352717809944686\\ +317 0.00349841080037579\\ +318 0.00346972213601006\\ +319 0.00344111232247518\\ +320 0.00341258157769011\\ +321 0.00338413012138901\\ +322 0.00335575817514826\\ +323 0.00332746596241382\\ +324 0.00329925370852406\\ +325 0.00327112164074077\\ +326 0.00324306998827306\\ +327 0.00321509898230687\\ +328 0.00318720885603513\\ +329 0.0031593998446833\\ +330 0.00313167218554325\\ +331 0.00310402611800003\\ +332 0.00307646188356444\\ +333 0.00304897972590616\\ +334 0.00302157989088305\\ +335 0.00299426262657563\\ +336 0.00296702818332233\\ +337 0.00293987681375033\\ +338 0.00291280877281477\\ +339 0.0028858243178311\\ +340 0.00285892370851336\\ +341 0.00283210720701309\\ +342 0.0028053750779542\\ +343 0.00277872758847611\\ +344 0.00275216500827033\\ +345 0.00272568760962288\\ +346 0.00269929566745765\\ +347 0.00267298945937576\\ +348 0.00264676926570329\\ +349 0.00262063536953265\\ +350 0.00259458805676995\\ +351 0.00256862761618329\\ +352 0.00254275433944795\\ +353 0.00251696852119695\\ +354 0.00249127045907285\\ +355 0.0024656604537759\\ +356 0.00244013880912067\\ +357 0.00241470583208676\\ +358 0.00238936183287563\\ +359 0.00236410712496877\\ +360 0.00233894202518255\\ +361 0.0023138668537316\\ +362 0.00228888193428664\\ +363 0.00226398759403862\\ +364 0.00223918416376428\\ +365 0.00221447197788892\\ +366 0.00218985137455768\\ +367 0.00216532269570178\\ +368 0.00214088628711106\\ +369 0.00211654249850854\\ +370 0.00209229168362315\\ +371 0.00206813420026647\\ +372 0.0020440704104159\\ +373 0.00202010068029071\\ +374 0.00199622538044178\\ +375 0.00197244488583009\\ +376 0.00194875957592076\\ +377 0.001925169834773\\ +378 0.00190167605113088\\ +379 0.00187827861852296\\ +380 0.00185497793535806\\ +381 0.00183177440502798\\ +382 0.00180866843601563\\ +383 0.00178566044199606\\ +384 0.00176275084195269\\ +385 0.00173994006029262\\ +386 0.00171722852695989\\ +387 0.00169461667756041\\ +388 0.00167210495348647\\ +389 0.00164969380204556\\ +390 0.00162738367659497\\ +391 0.00160517503667887\\ +392 0.00158306834816748\\ +393 0.0015610640834086\\ +394 0.0015391627213757\\ +395 0.00151736474782592\\ +396 0.00149567065545892\\ +397 0.0014740809440871\\ +398 0.00145259612080798\\ +399 0.00143121670018043\\ +400 0.00140994320441235\\ +401 0.00138877616355118\\ +402 0.00136771611567928\\ +403 0.00134676360712423\\ +404 0.0013259191926667\\ +405 0.00130518343576434\\ +406 0.00128455690877751\\ +407 0.00126404019320747\\ +408 0.00124363387994308\\ +409 0.00122333856951558\\ +410 0.00120315487236122\\ +411 0.00118308340910146\\ +412 0.00116312481082477\\ +413 0.00114327971938729\\ +414 0.0011235487877217\\ +415 0.00110393268015729\\ +416 0.00108443207275845\\ +417 0.00106504765367342\\ +418 0.00104578012349787\\ +419 0.00102663019565582\\ +420 0.00100759859679339\\ +421 0.000988686067195324\\ +422 0.000969893361216197\\ +423 0.00095122124773175\\ +424 0.000932670510608069\\ +425 0.000914241949201074\\ +426 0.000895936378867371\\ +427 0.000877754631508528\\ +428 0.000859697556137518\\ +429 0.000841766019473127\\ +430 0.000823960906565026\\ +431 0.000806283121448403\\ +432 0.000788733587831909\\ +433 0.000771313249822707\\ +434 0.000754023072687432\\ +435 0.000736864043657104\\ +436 0.000719837172769218\\ +437 0.000702943493760668\\ +438 0.000686184065011434\\ +439 0.000669559970537391\\ +440 0.000653072321041874\\ +441 0.000636722255029885\\ +442 0.000620510939986573\\ +443 0.000604439573630549\\ +444 0.000588509385236614\\ +445 0.00057272163704996\\ +446 0.000557077625787128\\ +447 0.000541578684230604\\ +448 0.000526226182934612\\ +449 0.000511021532042753\\ +450 0.000495966183230885\\ +451 0.000481061631787299\\ +452 0.000466309418840188\\ +453 0.000451711133747819\\ +454 0.000437268416668315\\ +455 0.000422982961323787\\ +456 0.000408856517981088\\ +457 0.000394890896668832\\ +458 0.000381087970655137\\ +459 0.000367449680220597\\ +460 0.000353978036748788\\ +461 0.000340675127175451\\ +462 0.000327543118842089\\ +463 0.000314584264791908\\ +464 0.00030180090957059\\ +465 0.000289195495589093\\ +466 0.000276770570127334\\ +467 0.000264528793057209\\ +468 0.000252472945386399\\ +469 0.00024060593873623\\ +470 0.000228930825897021\\ +471 0.00021745081260729\\ +472 0.000206169270765922\\ +473 0.000195089753292042\\ +474 0.000184216010914346\\ +475 0.000173552011227236\\ +476 0.000163101960414044\\ +477 0.000152870328142166\\ +478 0.000142861876255546\\ +479 0.000133081692029448\\ +480 0.000123535226978182\\ +481 0.000114228342456702\\ +482 0.000105167363667044\\ +483 9.63591441704975e-05\\ +484 8.78111436770309e-05\\ +485 7.9531522846157e-05\\ +486 7.15292601814999e-05\\ +487 6.38142980942563e-05\\ +488 5.63977281764285e-05\\ +489 4.9292030273616e-05\\ +490 4.25113871340903e-05\\ +491 3.6072108144126e-05\\ +492 2.99932155320352e-05\\ +493 2.4297281571859e-05\\ +494 1.90116702899788e-05\\ +495 1.4170462377942e-05\\ +496 9.81758432223143e-06\\ +497 6.01201802407357e-06\\ +498 2.83409247558248e-06\\ +499 4.26545343219991e-16\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file diff --git a/Claudio_Maggioni_2/main.m b/Claudio_Maggioni_2/main.m index 2bff263..c47c300 100644 --- a/Claudio_Maggioni_2/main.m +++ b/Claudio_Maggioni_2/main.m @@ -26,11 +26,13 @@ if plots plot(0:(size(ys,1)-1), ys); sgtitle("Objective function values per iteration"); axis([-1 500 -inf +inf]); + %matlab2tikz('showInfo', false, './obvalues.tex'); figure; semilogy(0:(size(gnorms,1)-1), gnorms); sgtitle("Log of gradient norm per iteration"); axis([-1 500 -inf +inf]); + %matlab2tikz('showInfo', false, './gnorms.tex'); end %% 2.1 - Matrix definitions @@ -56,12 +58,16 @@ n = 10; if plots enl_plot(x1, xs1, A1); sgtitle("Log energy norm of the error per iter. (matrix A1)"); + %matlab2tikz('showInfo', false, './a1.tex'); enl_plot(x2, xs2, A2); sgtitle("Log energy norm of the error per iter. (matrix A2)"); + %matlab2tikz('showInfo', false, './a2.tex'); enl_plot(x3, xs3, A3) sgtitle("Log energy norm of the error per iter. (matrix A3)"); + %matlab2tikz('showInfo', false, './a3.tex'); enl_plot(x4, xs4, A4); sgtitle("Log energy norm of the error per iter. (matrix A4)"); + %matlab2tikz('showInfo', false, './a4.tex'); end function enl_plot(xsol, xs, A) diff --git a/Claudio_Maggioni_2/obvalues.tex b/Claudio_Maggioni_2/obvalues.tex new file mode 100644 index 0000000..9afc965 --- /dev/null +++ b/Claudio_Maggioni_2/obvalues.tex @@ -0,0 +1,520 @@ +% This file was created by matlab2tikz. +% +\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}% +% +\begin{tikzpicture} + +\begin{axis}[% +width=6.028in, +height=4.754in, +at={(1.011in,0.642in)}, +scale only axis, +xmin=-1, +xmax=500, +axis background/.style={fill=white} +] +\addplot [color=mycolor1, forget plot] + table[row sep=crcr]{% +0 0\\ +1 -2.49999498998749e-07\\ +2 -4.98998000007523e-07\\ +3 -7.46997511046363e-07\\ +4 -9.94000040135306e-07\\ +5 -1.2400075952944e-06\\ +6 -1.48502218454367e-06\\ +7 -1.72904581590317e-06\\ +8 -1.97208049739294e-06\\ +9 -2.21412823703301e-06\\ +10 -2.45519104284342e-06\\ +11 -2.69527092284423e-06\\ +12 -2.93436988505546e-06\\ +13 -3.17248993749715e-06\\ +14 -3.40963308818935e-06\\ +15 -3.64580134515209e-06\\ +16 -3.88099671640543e-06\\ +17 -4.11522120996938e-06\\ +18 -4.348476833864e-06\\ +19 -4.58076559610935e-06\\ +20 -4.81208950472541e-06\\ +21 -5.04245056773228e-06\\ +22 -5.27185079314997e-06\\ +23 -5.50029218899853e-06\\ +24 -5.72777676329799e-06\\ +25 -5.95430652406841e-06\\ +26 -6.1798834793298e-06\\ +27 -6.40450963710222e-06\\ +28 -6.6281870054057e-06\\ +29 -6.85091759226031e-06\\ +30 -7.07270340568605e-06\\ +31 -7.29354645370299e-06\\ +32 -7.51344874433114e-06\\ +33 -7.73241228559059e-06\\ +34 -7.95043908550132e-06\\ +35 -8.16753115208339e-06\\ +36 -8.38369049335685e-06\\ +37 -8.59891911734177e-06\\ +38 -8.81321903205812e-06\\ +39 -9.02659224552598e-06\\ +40 -9.2390407657654e-06\\ +41 -9.45056660079637e-06\\ +42 -9.66117175863905e-06\\ +43 -9.87085824731335e-06\\ +44 -1.00796280748393e-05\\ +45 -1.02874832492371e-05\\ +46 -1.04944257785266e-05\\ +47 -1.0700457670728e-05\\ +48 -1.09055809338613e-05\\ +49 -1.11097975759464e-05\\ +50 -1.13131096050035e-05\\ +51 -1.15155190290526e-05\\ +52 -1.17170278561137e-05\\ +53 -1.19176380942069e-05\\ +54 -1.21173517513522e-05\\ +55 -1.23161708355696e-05\\ +56 -1.25140973548793e-05\\ +57 -1.27111333173011e-05\\ +58 -1.29072807308553e-05\\ +59 -1.31025416035617e-05\\ +60 -1.32969179434405e-05\\ +61 -1.34904117585117e-05\\ +62 -1.36830250567953e-05\\ +63 -1.38747598463113e-05\\ +64 -1.40656181350799e-05\\ +65 -1.42556019311211e-05\\ +66 -1.44447132424548e-05\\ +67 -1.46329540771011e-05\\ +68 -1.48203264430801e-05\\ +69 -1.50068323484119e-05\\ +70 -1.51924738011164e-05\\ +71 -1.53772528092136e-05\\ +72 -1.55611713807237e-05\\ +73 -1.57442315236667e-05\\ +74 -1.59264352460625e-05\\ +75 -1.61077845559314e-05\\ +76 -1.62882814612932e-05\\ +77 -1.6467927970168e-05\\ +78 -1.66467260905761e-05\\ +79 -1.6824677830537e-05\\ +80 -1.70017851980713e-05\\ +81 -1.71780502011986e-05\\ +82 -1.73534748479392e-05\\ +83 -1.75280611463132e-05\\ +84 -1.77018111043402e-05\\ +85 -1.78747267300409e-05\\ +86 -1.80468100314348e-05\\ +87 -1.82180630165421e-05\\ +88 -1.8388487693383e-05\\ +89 -1.85580860699773e-05\\ +90 -1.87268601543451e-05\\ +91 -1.88948119545067e-05\\ +92 -1.90619434784818e-05\\ +93 -1.92282567342906e-05\\ +94 -1.93937537299532e-05\\ +95 -1.95584364734893e-05\\ +96 -1.97223069729193e-05\\ +97 -1.98853672362632e-05\\ +98 -2.0047619271541e-05\\ +99 -2.02090650867726e-05\\ +100 -2.03697066899782e-05\\ +101 -2.05295460891778e-05\\ +102 -2.06885852923914e-05\\ +103 -2.08468263076392e-05\\ +104 -2.10042711429409e-05\\ +105 -2.11609218063169e-05\\ +106 -2.13167803057871e-05\\ +107 -2.14718486493715e-05\\ +108 -2.16261288450902e-05\\ +109 -2.17796229009631e-05\\ +110 -2.19323328250106e-05\\ +111 -2.20842606252522e-05\\ +112 -2.22354083097083e-05\\ +113 -2.2385777886399e-05\\ +114 -2.25353713633441e-05\\ +115 -2.26841907485638e-05\\ +116 -2.28322380500781e-05\\ +117 -2.29795152759071e-05\\ +118 -2.31260244340707e-05\\ +119 -2.32717675325889e-05\\ +120 -2.3416746579482e-05\\ +121 -2.35609635827698e-05\\ +122 -2.37044205504726e-05\\ +123 -2.38471194906101e-05\\ +124 -2.39890624112026e-05\\ +125 -2.41302513202701e-05\\ +126 -2.42706882258324e-05\\ +127 -2.44103751359098e-05\\ +128 -2.45493140585224e-05\\ +129 -2.46875070016901e-05\\ +130 -2.48249559734329e-05\\ +131 -2.4961662981771e-05\\ +132 -2.50976300347242e-05\\ +133 -2.52328591403127e-05\\ +134 -2.53673523065564e-05\\ +135 -2.55011115414756e-05\\ +136 -2.56341388530901e-05\\ +137 -2.57664362494202e-05\\ +138 -2.58980057384856e-05\\ +139 -2.60288493283066e-05\\ +140 -2.61589690269032e-05\\ +141 -2.62883668422953e-05\\ +142 -2.6417044782503e-05\\ +143 -2.65450048555465e-05\\ +144 -2.66722490694456e-05\\ +145 -2.67987794322206e-05\\ +146 -2.69245979518913e-05\\ +147 -2.70497066364779e-05\\ +148 -2.71741074940006e-05\\ +149 -2.72978025324786e-05\\ +150 -2.74207937599329e-05\\ +151 -2.75430831843832e-05\\ +152 -2.76646728138492e-05\\ +153 -2.77855646563519e-05\\ +154 -2.79057607199107e-05\\ +155 -2.80252630125452e-05\\ +156 -2.81440735422763e-05\\ +157 -2.8262194317123e-05\\ +158 -2.83796273451063e-05\\ +159 -2.84963746342461e-05\\ +160 -2.8612438192562e-05\\ +161 -2.87278200280746e-05\\ +162 -2.88425221488035e-05\\ +163 -2.89565465627689e-05\\ +164 -2.90698952779907e-05\\ +165 -2.91825703024894e-05\\ +166 -2.92945736442844e-05\\ +167 -2.94059073113959e-05\\ +168 -2.95165733118442e-05\\ +169 -2.96265736536492e-05\\ +170 -2.9735910344831e-05\\ +171 -2.98445853934095e-05\\ +172 -2.99526008074053e-05\\ +173 -3.00599585948374e-05\\ +174 -3.01666607637271e-05\\ +175 -3.02727093220927e-05\\ +176 -3.0378106277956e-05\\ +177 -3.04828536393361e-05\\ +178 -3.05869534142538e-05\\ +179 -3.06904076107282e-05\\ +180 -3.07932182367798e-05\\ +181 -3.08953873004289e-05\\ +182 -3.09969168096946e-05\\ +183 -3.10978087725977e-05\\ +184 -3.11980651971581e-05\\ +185 -3.12976880913968e-05\\ +186 -3.13966794633319e-05\\ +187 -3.14950413209845e-05\\ +188 -3.15927756723748e-05\\ +189 -3.16898845255228e-05\\ +190 -3.17863698884481e-05\\ +191 -3.18822337691713e-05\\ +192 -3.19774781757112e-05\\ +193 -3.20721051160898e-05\\ +194 -3.21661165983263e-05\\ +195 -3.22595146304395e-05\\ +196 -3.23523012204516e-05\\ +197 -3.24444783763807e-05\\ +198 -3.25360481062477e-05\\ +199 -3.26270124180731e-05\\ +200 -3.27173733198765e-05\\ +201 -3.28071328196771e-05\\ +202 -3.28962929254965e-05\\ +203 -3.29848556453538e-05\\ +204 -3.30728229872694e-05\\ +205 -3.31601969592628e-05\\ +206 -3.32469795693543e-05\\ +207 -3.33331728255645e-05\\ +208 -3.34187787359135e-05\\ +209 -3.35037993084193e-05\\ +210 -3.35882365511042e-05\\ +211 -3.36720924719877e-05\\ +212 -3.37553690790896e-05\\ +213 -3.38380683804296e-05\\ +214 -3.39201923840285e-05\\ +215 -3.40017430979061e-05\\ +216 -3.40827225300819e-05\\ +217 -3.41631326885767e-05\\ +218 -3.42429755814097e-05\\ +219 -3.43222532166018e-05\\ +220 -3.4400967602173e-05\\ +221 -3.44791207461421e-05\\ +222 -3.45567146565305e-05\\ +223 -3.46337513413574e-05\\ +224 -3.47102328086444e-05\\ +225 -3.47861610664094e-05\\ +226 -3.48615381226735e-05\\ +227 -3.49363659854567e-05\\ +228 -3.50106466627788e-05\\ +229 -3.50843821626602e-05\\ +230 -3.51575744931207e-05\\ +231 -3.52302256621806e-05\\ +232 -3.53023376778599e-05\\ +233 -3.53739125481775e-05\\ +234 -3.54449522811552e-05\\ +235 -3.55154588848124e-05\\ +236 -3.55854343671688e-05\\ +237 -3.56548807362442e-05\\ +238 -3.57238000000597e-05\\ +239 -3.57921941666347e-05\\ +240 -3.5860065243989e-05\\ +241 -3.59274152401429e-05\\ +242 -3.59942461631166e-05\\ +243 -3.60605600209297e-05\\ +244 -3.61263588216028e-05\\ +245 -3.61916445731555e-05\\ +246 -3.62564192836083e-05\\ +247 -3.63206849609801e-05\\ +248 -3.63844436132928e-05\\ +249 -3.64476972485651e-05\\ +250 -3.6510447874817e-05\\ +251 -3.65726975000693e-05\\ +252 -3.66344481323419e-05\\ +253 -3.6695701779654e-05\\ +254 -3.67564604500267e-05\\ +255 -3.68167261514788e-05\\ +256 -3.68765008920319e-05\\ +257 -3.6935786679705e-05\\ +258 -3.69945855225181e-05\\ +259 -3.70528994284917e-05\\ +260 -3.71107304056457e-05\\ +261 -3.71680804620006e-05\\ +262 -3.7224951605575e-05\\ +263 -3.72813458443905e-05\\ +264 -3.73372651864663e-05\\ +265 -3.73927116398226e-05\\ +266 -3.74476872124801e-05\\ +267 -3.75021939124574e-05\\ +268 -3.75562337477762e-05\\ +269 -3.76098087264556e-05\\ +270 -3.76629208565149e-05\\ +271 -3.77155721459756e-05\\ +272 -3.77677646028569e-05\\ +273 -3.78195002351795e-05\\ +274 -3.7870781050963e-05\\ +275 -3.79216090582271e-05\\ +276 -3.79719862649921e-05\\ +277 -3.80219146792792e-05\\ +278 -3.80713963091063e-05\\ +279 -3.81204331624946e-05\\ +280 -3.81690272474643e-05\\ +281 -3.82171805720353e-05\\ +282 -3.82648951442273e-05\\ +283 -3.83121729720608e-05\\ +284 -3.8359016063556e-05\\ +285 -3.84054264267319e-05\\ +286 -3.84514060696092e-05\\ +287 -3.84969570002087e-05\\ +288 -3.85420812265484e-05\\ +289 -3.85867807566506e-05\\ +290 -3.8631057598534e-05\\ +291 -3.86749137602193e-05\\ +292 -3.87183512497264e-05\\ +293 -3.87613720750746e-05\\ +294 -3.88039782442848e-05\\ +295 -3.88461717653767e-05\\ +296 -3.88879546463705e-05\\ +297 -3.89293288952863e-05\\ +298 -3.89702965201432e-05\\ +299 -3.90108595289633e-05\\ +300 -3.90510199297643e-05\\ +301 -3.90907797305675e-05\\ +302 -3.91301409393933e-05\\ +303 -3.91691055642609e-05\\ +304 -3.92076756131906e-05\\ +305 -3.92458530942022e-05\\ +306 -3.92836400153165e-05\\ +307 -3.93210383845528e-05\\ +308 -3.9358050209931e-05\\ +309 -3.93946774994719e-05\\ +310 -3.94309222611957e-05\\ +311 -3.94667865031211e-05\\ +312 -3.95022722332695e-05\\ +313 -3.95373814596599e-05\\ +314 -3.95721161903128e-05\\ +315 -3.96064784332487e-05\\ +316 -3.96404701964871e-05\\ +317 -3.96740934880475e-05\\ +318 -3.97073503159513e-05\\ +319 -3.97402426882182e-05\\ +320 -3.97727726128671e-05\\ +321 -3.9804942097919e-05\\ +322 -3.98367531513941e-05\\ +323 -3.98682077813113e-05\\ +324 -3.98993079956921e-05\\ +325 -3.99300558025555e-05\\ +326 -3.99604532099222e-05\\ +327 -3.99905022258122e-05\\ +328 -4.00202048582442e-05\\ +329 -4.00495631152405e-05\\ +330 -4.00785790048194e-05\\ +331 -4.01072545350018e-05\\ +332 -4.01355917138077e-05\\ +333 -4.0163592549256e-05\\ +334 -4.0191259049368e-05\\ +335 -4.02185932221634e-05\\ +336 -4.0245597075662e-05\\ +337 -4.02722726178848e-05\\ +338 -4.02986218568505e-05\\ +339 -4.03246468005798e-05\\ +340 -4.03503494570928e-05\\ +341 -4.0375731834409e-05\\ +342 -4.04007959405494e-05\\ +343 -4.04255437835334e-05\\ +344 -4.04499773713804e-05\\ +345 -4.04740987121121e-05\\ +346 -4.04979098137474e-05\\ +347 -4.05214126843061e-05\\ +348 -4.05446093318094e-05\\ +349 -4.05675017642757e-05\\ +350 -4.05900919897264e-05\\ +351 -4.06123820161814e-05\\ +352 -4.06343738516606e-05\\ +353 -4.06560695041833e-05\\ +354 -4.06774709817706e-05\\ +355 -4.06985802924417e-05\\ +356 -4.07193994442172e-05\\ +357 -4.0739930445117e-05\\ +358 -4.07601753031609e-05\\ +359 -4.07801360263692e-05\\ +360 -4.07998146227615e-05\\ +361 -4.08192131003588e-05\\ +362 -4.08383334671805e-05\\ +363 -4.08571777312461e-05\\ +364 -4.08757479005769e-05\\ +365 -4.08940459831921e-05\\ +366 -4.09120739871118e-05\\ +367 -4.09298339203564e-05\\ +368 -4.09473277909454e-05\\ +369 -4.09645576068992e-05\\ +370 -4.09815253762379e-05\\ +371 -4.09982331069807e-05\\ +372 -4.1014682807149e-05\\ +373 -4.10308764847627e-05\\ +374 -4.10468161478408e-05\\ +375 -4.10625038044038e-05\\ +376 -4.1077941462472e-05\\ +377 -4.10931311300654e-05\\ +378 -4.11080748152034e-05\\ +379 -4.11227745259067e-05\\ +380 -4.11372322701953e-05\\ +381 -4.11514500560885e-05\\ +382 -4.11654298916077e-05\\ +383 -4.11791737847719e-05\\ +384 -4.11926837436015e-05\\ +385 -4.12059617761164e-05\\ +386 -4.12190098903368e-05\\ +387 -4.12318300942827e-05\\ +388 -4.12444243959737e-05\\ +389 -4.12567948034309e-05\\ +390 -4.12689433246734e-05\\ +391 -4.12808719677215e-05\\ +392 -4.12925827405955e-05\\ +393 -4.13040776513146e-05\\ +394 -4.13153587078997e-05\\ +395 -4.13264279183704e-05\\ +396 -4.13372872907473e-05\\ +397 -4.13479388330498e-05\\ +398 -4.13583845532985e-05\\ +399 -4.13686264595122e-05\\ +400 -4.13786665597124e-05\\ +401 -4.13885068619189e-05\\ +402 -4.13981493741518e-05\\ +403 -4.14075961044303e-05\\ +404 -4.14168490607745e-05\\ +405 -4.14259102512055e-05\\ +406 -4.14347816837422e-05\\ +407 -4.14434653664058e-05\\ +408 -4.14519633072155e-05\\ +409 -4.1460277514191e-05\\ +410 -4.14684099953535e-05\\ +411 -4.14763627587221e-05\\ +412 -4.14841378123176e-05\\ +413 -4.14917371641589e-05\\ +414 -4.1499162822267e-05\\ +415 -4.15064167946621e-05\\ +416 -4.15135010893635e-05\\ +417 -4.15204177143913e-05\\ +418 -4.1527168677766e-05\\ +419 -4.15337559875071e-05\\ +420 -4.15401816516357e-05\\ +421 -4.15464476781711e-05\\ +422 -4.15525560751325e-05\\ +423 -4.15585088505413e-05\\ +424 -4.1564308012417e-05\\ +425 -4.15699555687797e-05\\ +426 -4.15754535276496e-05\\ +427 -4.15808038970462e-05\\ +428 -4.15860086849903e-05\\ +429 -4.15910698995011e-05\\ +430 -4.15959895485994e-05\\ +431 -4.16007696403049e-05\\ +432 -4.16054121826373e-05\\ +433 -4.16099191836174e-05\\ +434 -4.16142926512643e-05\\ +435 -4.16185345935989e-05\\ +436 -4.16226470186414e-05\\ +437 -4.16266319344109e-05\\ +438 -4.16304913489283e-05\\ +439 -4.16342272702127e-05\\ +440 -4.16378417062846e-05\\ +441 -4.16413366651644e-05\\ +442 -4.16447141548716e-05\\ +443 -4.16479761834271e-05\\ +444 -4.16511247588496e-05\\ +445 -4.16541618891607e-05\\ +446 -4.16570895823782e-05\\ +447 -4.1659909846525e-05\\ +448 -4.16626246896192e-05\\ +449 -4.1665236119681e-05\\ +450 -4.16677461447311e-05\\ +451 -4.1670156772789e-05\\ +452 -4.16724700118754e-05\\ +453 -4.16746878700097e-05\\ +454 -4.16768123552124e-05\\ +455 -4.16788454755031e-05\\ +456 -4.16807892389022e-05\\ +457 -4.16826456534285e-05\\ +458 -4.16844167271039e-05\\ +459 -4.16861044679475e-05\\ +460 -4.16877108839802e-05\\ +461 -4.16892379832203e-05\\ +462 -4.16906877736888e-05\\ +463 -4.16920622634066e-05\\ +464 -4.16933634603923e-05\\ +465 -4.1694593372667e-05\\ +466 -4.16957540082503e-05\\ +467 -4.16968473751621e-05\\ +468 -4.16978754814228e-05\\ +469 -4.16988403350517e-05\\ +470 -4.16997439440699e-05\\ +471 -4.17005883164966e-05\\ +472 -4.1701375460352e-05\\ +473 -4.17021073836576e-05\\ +474 -4.17027860944303e-05\\ +475 -4.17034136006933e-05\\ +476 -4.17039919104647e-05\\ +477 -4.17045230317654e-05\\ +478 -4.17050089726151e-05\\ +479 -4.17054517410336e-05\\ +480 -4.17058533450415e-05\\ +481 -4.17062157926589e-05\\ +482 -4.17065410919058e-05\\ +483 -4.17068312508013e-05\\ +484 -4.17070882773665e-05\\ +485 -4.17073141796206e-05\\ +486 -4.17075109655854e-05\\ +487 -4.17076806432783e-05\\ +488 -4.17078252207211e-05\\ +489 -4.17079467059335e-05\\ +490 -4.17080471069358e-05\\ +491 -4.1708128431747e-05\\ +492 -4.17081926883885e-05\\ +493 -4.17082418848793e-05\\ +494 -4.17082780292402e-05\\ +495 -4.17083031294906e-05\\ +496 -4.1708319193651e-05\\ +497 -4.17083282297417e-05\\ +498 -4.17083322457828e-05\\ +499 -4.17083332497933e-05\\ +}; +\end{axis} +\end{tikzpicture}% \ No newline at end of file