TP-traitement-audio-visuel/TP1/rapport/rapport.html
2023-06-22 20:47:16 +02:00

386 lines
51 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fonctions auxilliaires</title>
<style>
/* From extension vscode.github */
.vscode-dark img[src$=\#gh-light-mode-only],
.vscode-light img[src$=\#gh-dark-mode-only] {
display: none;
}
/* From extension vscode.markdown-math */
@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype");font-weight:700;font-style:italic}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype");font-weight:400;font-style:italic}@font-face{font-family:"KaTeX_SansSerif";src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype");font-weight:400;font-style:normal}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto;border-color:currentColor}.katex *{-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.13.0"}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{display:inline-flex;flex-direction:column;align-items:baseline}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-content;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{counter-increment:katexEqnNo;content:"(" counter(katexEqnNo) ")"}.katex .mml-eqn-num:before{counter-increment:mmlEqnNo;content:"(" counter(mmlEqnNo) ")"}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;position:absolute;left:calc(50% + .3em);text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.katex-error {
color: var(--vscode-editorError-foreground);
}
/* From extension marp-team.marp-vscode */
#marp-vscode {
all: initial;
}
/* Override VS Code default CSS rules reverting to initial
https://github.com/microsoft/vscode/blob/master/src/vs/workbench/contrib/webview/browser/pre/main.js#L53 */
body.marp-vscode {
padding: 0;
}
body.marp-vscode img {
max-width: unset;
max-height: unset;
}
body.marp-vscode a,
body.marp-vscode a:hover,
body.marp-vscode code {
color: unset;
}
body.marp-vscode blockquote {
background: unset;
border-color: unset;
}
@media screen {
body.marp-vscode {
overflow-y: scroll;
}
#marp-vscode [data-marp-vscode-slide-wrapper] {
margin: 20px;
}
#marp-vscode svg[data-marpit-svg] {
box-shadow: 0 5px 10px rgb(0 0 0 / 25%);
display: block;
margin: 0;
}
/* Based on https://github.com/microsoft/vscode/blob/master/extensions/markdown-language-features/media/markdown.css */
#code-csp-warning {
background-color: #444;
box-shadow: 1px 1px 1px rgb(0 0 0 / 25%);
color: white;
cursor: pointer;
font-family: sans-serif;
font-size: 12px;
line-height: 22px;
margin: 16px;
padding: 6px;
position: fixed;
right: 0;
text-align: center;
top: 0;
word-wrap: break-word;
}
#code-csp-warning:hover {
text-decoration: none;
background-color: #007acc;
box-shadow: 2px 2px 2px rgb(0 0 0 / 25%);
}
}
@media print {
body.marp-vscode #code-csp-warning {
display: none;
}
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
font-size: 14px;
line-height: 1.6;
}
</style>
<style>
.task-list-item { list-style-type: none; } .task-list-item-checkbox { margin-left: -20px; vertical-align: middle; }
</style>
<script src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script>
<script type="text/javascript">
/* From extension marp-team.marp-vscode */
var O=Object.defineProperty;var n=(V,S)=>O(V,"name",{value:S,configurable:!0});(()=>{var V={676:(v,y,s)=>{v.exports=s(185)},185:(v,y)=>{"use strict";var s;s={value:!0};const A="marpitSVGPolyfill:setZoomFactor,",i=Symbol();let a,e;function g(o){const l=typeof o=="object"&&o.target||document,p=typeof o=="object"?o.zoom:o;window[i]||(Object.defineProperty(window,i,{configurable:!0,value:!0}),window.addEventListener("message",({data:t,origin:f})=>{if(f===window.origin)try{if(t&&typeof t=="string"&&t.startsWith(A)){const[,r]=t.split(","),c=Number.parseFloat(r);Number.isNaN(c)||(e=c)}}catch(r){console.error(r)}}));let b=!1;Array.from(l.querySelectorAll("svg[data-marpit-svg]"),t=>{var f,r,c,w;t.style.transform||(t.style.transform="translateZ(0)");const h=p||e||t.currentScale||1;a!==h&&(a=h,b=h);const $=t.getBoundingClientRect(),{length:M}=t.children;for(let m=0;m<M;m+=1){const _=t.children[m],d=_.getScreenCTM();if(d){const k=(r=(f=_.x)===null||f===void 0?void 0:f.baseVal.value)!==null&&r!==void 0?r:0,q=(w=(c=_.y)===null||c===void 0?void 0:c.baseVal.value)!==null&&w!==void 0?w:0,E=_.firstElementChild,{style:x}=E;x.transformOrigin||(x.transformOrigin=`${-k}px ${-q}px`),x.transform=`scale(${h}) matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, ${d.e-$.left}, ${d.f-$.top}) translateZ(0.0001px)`}}}),b!==!1&&Array.from(l.querySelectorAll("iframe"),({contentWindow:t})=>{t==null||t.postMessage(`${A}${b}`,window.origin==="null"?"*":window.origin)})}n(g,"n"),a=1,e=void 0;const u=n((o,l,p)=>{if(o.getAttribute(l)!==p)return o.setAttribute(l,p),!0},"i");function L({once:o=!1,target:l=document}={}){const p=navigator.vendor==="Apple Computer, Inc."?[g]:[];let b=!o;const t=n(()=>{for(const f of p)f({target:l});(function(f=document){Array.from(f.querySelectorAll('svg[data-marp-fitting="svg"]'),r=>{var c;const w=r.firstChild,h=w.firstChild,{scrollWidth:$,scrollHeight:M}=h;let m,_=1;if(r.hasAttribute("data-marp-fitting-code")&&(m=(c=r.parentElement)===null||c===void 0?void 0:c.parentElement),r.hasAttribute("data-marp-fitting-math")&&(m=r.parentElement),m){const E=getComputedStyle(m),x=Math.ceil(m.clientWidth-parseFloat(E.paddingLeft||"0")-parseFloat(E.paddingRight||"0"));x&&(_=x)}const d=Math.max($,_),k=Math.max(M,1),q=`0 0 ${d} ${k}`;u(w,"width",`${d}`),u(w,"height",`${k}`),u(r,"preserveAspectRatio",getComputedStyle(r).getPropertyValue("--preserve-aspect-ratio")||"xMinYMin meet"),u(r,"viewBox",q)&&r.classList.toggle("__reflow__")})})(l),b&&window.requestAnimationFrame(t)},"a");return t(),()=>{b=!1}}n(L,"a");const C=Symbol(),F=n((o=document)=>{if(typeof window=="undefined")throw new Error("Marp Core's browser script is valid only in browser context.");if(o[C])return o[C];const l=L({target:o}),p=n(()=>{l(),delete o[C]},"r");return Object.defineProperty(o,C,{configurable:!0,value:p}),p},"s");s=F,s=F,y.observer=L}},S={};function B(v){var y=S[v];if(y!==void 0)return y.exports;var s=S[v]={exports:{}};return V[v](s,s.exports,B),s.exports}n(B,"__webpack_require__");var j={};(()=>{"use strict";var v=B(676);function y(){let i,a;const e=n(()=>{const u=!!document.getElementById("marp-vscode");i!==u&&(document.body.classList.toggle("marp-vscode",u),u?a=(0,v.observer)():(a==null||a(),a=void 0),i=u),i?s():A()},"updateCallback");window.addEventListener("load",()=>window.setTimeout(e,100)),window.addEventListener("vscode.markdown.updateContent",e),e()}n(y,"preview");const s=n(()=>{const i=document.querySelectorAll("style:not(#marp-vscode-style):not(#_defaultStyles):not([data-marp-vscode-body])"),a=document.querySelectorAll('link[rel="stylesheet"][href]:not([href*="marp-vscode"])');i.forEach(e=>{var g;e.closest("#marp-vscode")||(e.dataset.marpVscodeBody=(g=e.textContent)!=null?g:"",e.textContent="")}),a.forEach(e=>{if(e.closest("#marp-vscode"))return;const{href:g}=e;e.dataset.marpVscodeHref=g,e.removeAttribute("href")})},"removeStyles"),A=n(()=>{const i=document.querySelectorAll("style[data-marp-vscode-body]"),a=document.querySelectorAll("link[data-marp-vscode-href]");i.forEach(e=>{e.textContent=e.dataset.marpVscodeBody||"",delete e.dataset.marpVscodeBody}),a.forEach(e=>{e.href=e.dataset.marpVscodeHref||"",delete e.dataset.marpVscodeHref})},"restoreStyles");y()})()})();
</script>
</head>
<body class="vscode-body vscode-light">
<hr>
<h2 id="author-laurent-fainsintitle-tav-tp1-lfdescription-rapport-de-traitement-des-données-audio-visuelles-travail-pratique-1-laurent-fainsin">author: Laurent Fainsin
title: TAV, TP1, LF
description: Rapport de Traitement des données audio-visuelles, Travail Pratique 1, Laurent Fainsin</h2>
<h1 id="fonctions-auxilliaires">Fonctions auxilliaires</h1>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">y</span> = <span class="hljs-title">bezier</span><span class="hljs-params">(beta_0,beta,beta_d,x)</span></span>
d = <span class="hljs-built_in">length</span>(<span class="hljs-built_in">beta</span>)+<span class="hljs-number">1</span>;
y = beta_0 * (<span class="hljs-number">1</span>-x).^d + beta_d * x.^d;
<span class="hljs-keyword">for</span> <span class="hljs-built_in">i</span> = <span class="hljs-number">1</span>:d<span class="hljs-number">-1</span>
y = y + <span class="hljs-built_in">beta</span>(<span class="hljs-built_in">i</span>) * <span class="hljs-built_in">nchoosek</span>(d,<span class="hljs-built_in">i</span>) * x.^<span class="hljs-built_in">i</span> .* (<span class="hljs-number">1</span>-x).^(d-<span class="hljs-built_in">i</span>);
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">y</span> = <span class="hljs-title">bezier_bruitee</span><span class="hljs-params">(beta_0,beta,beta_d,x,sigma)</span></span>
y = bezier(beta_0,<span class="hljs-built_in">beta</span>,beta_d,x)+sigma*<span class="hljs-built_in">randn</span>(<span class="hljs-built_in">size</span>(x));
<span class="hljs-keyword">end</span>
</div></code></pre>
<h1 id="exercice-1">Exercice 1</h1>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">estimation</span> = <span class="hljs-title">moindres_carres</span><span class="hljs-params">(D_app, beta_0, beta_d, d)</span></span>
X = D_app(<span class="hljs-number">1</span>,:)&#x27;;
Y = D_app(<span class="hljs-number">2</span>,:)&#x27;;
B = Y - beta_0*(<span class="hljs-number">1</span>-X).^d - beta_d*(X.^d);
A = <span class="hljs-built_in">zeros</span>(<span class="hljs-built_in">length</span>(X), d<span class="hljs-number">-1</span>);
<span class="hljs-keyword">for</span> <span class="hljs-built_in">i</span>=<span class="hljs-number">1</span>:(d<span class="hljs-number">-1</span>)
A(:,<span class="hljs-built_in">i</span>) = <span class="hljs-built_in">nchoosek</span>(d, <span class="hljs-built_in">i</span>) .* X.^<span class="hljs-built_in">i</span> .* (<span class="hljs-number">1</span>-X).^(d-<span class="hljs-built_in">i</span>);
<span class="hljs-keyword">end</span>
estimation = A \ B;
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div>donnees_apprentissage;
close all;
<span class="hljs-comment">% DegrŽé de la courbe de BŽezier </span>
d = <span class="hljs-number">8</span>;
<span class="hljs-comment">% Estimation des paramètres de la courbe de BŽezier (sauf beta_0 et beta_d) :</span>
beta_estime = moindres_carres(D_app,beta_0,beta_d,d);
<span class="hljs-comment">% TracŽ de la courbe de BŽezier estimŽe, de degréŽ d (trait rouge) :</span>
y_estime = bezier(beta_0,beta_estime,beta_d,x);
<span class="hljs-built_in">plot</span>(x,y_estime,<span class="hljs-string">&#x27;-r&#x27;</span>,<span class="hljs-string">&#x27;MarkerSize&#x27;</span>,<span class="hljs-number">10</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">3</span>);
lg = <span class="hljs-built_in">legend</span>(<span class="hljs-string">&#x27; Modele exact&#x27;</span>,<span class="hljs-string">&#x27; Donnees d&#x27;&#x27;apprentissage&#x27;</span>,[<span class="hljs-string">&#x27; Modele estime ($d=&#x27;</span> num2str(d) <span class="hljs-string">&#x27;$)&#x27;</span>],<span class="hljs-string">&#x27;Location&#x27;</span>,<span class="hljs-string">&#x27;Best&#x27;</span>);
set(lg,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>);
</div></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_1.svg">
<h1 id="exercice-2">Exercice 2</h1>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">erreur</span> = <span class="hljs-title">erreur_apprentissage</span><span class="hljs-params">(D_app,beta_0,beta_d,d)</span></span>
X = D_app(<span class="hljs-number">1</span>,:)&#x27;;
Y = D_app(<span class="hljs-number">2</span>,:)&#x27;;
<span class="hljs-built_in">beta</span> = moindres_carres(D_app, beta_0, beta_d, d);
estimation = bezier(beta_0, <span class="hljs-built_in">beta</span>, beta_d, X);
erreur = <span class="hljs-built_in">mean</span>((estimation - Y).^<span class="hljs-number">2</span>);
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div>donnees_apprentissage;
close all;
<span class="hljs-comment">% Calcul de l&#x27;erreur d&#x27;apprentissage en fonction de d :</span>
liste_d = <span class="hljs-number">2</span>:<span class="hljs-built_in">length</span>(D_app);
liste_erreurs_apprentissage = [];
<span class="hljs-keyword">for</span> d = liste_d
erreur = erreur_apprentissage(D_app,beta_0,beta_d,d);
liste_erreurs_apprentissage = [liste_erreurs_apprentissage erreur];
<span class="hljs-keyword">end</span>
<span class="hljs-comment">% TracŽ de l&#x27;erreur d&#x27;apprentissage en fonction de d :</span>
<span class="hljs-built_in">figure</span>(<span class="hljs-string">&#x27;Name&#x27;</span>,<span class="hljs-string">&#x27;Erreur d&#x27;&#x27;apprentissage&#x27;</span>,<span class="hljs-string">&#x27;Position&#x27;</span>,[<span class="hljs-number">0.4</span>*L,<span class="hljs-number">0.05</span>*H,<span class="hljs-number">0.6</span>*L,<span class="hljs-number">0.7</span>*H]);
<span class="hljs-built_in">plot</span>(liste_d,liste_erreurs_apprentissage,<span class="hljs-string">&#x27;sb-&#x27;</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">2</span>);
set(gca,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">20</span>);
xlabel(<span class="hljs-string">&#x27;$d$&#x27;</span>,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
ylabel(<span class="hljs-string">&#x27;Erreur&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
<span class="hljs-built_in">legend</span>(<span class="hljs-string">&#x27; Erreur d&#x27;&#x27;apprentissage&#x27;</span>,<span class="hljs-string">&#x27;Location&#x27;</span>,<span class="hljs-string">&#x27;Best&#x27;</span>);
</div></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_2.svg">
<h1 id="données-de-test">Données de test</h1>
<h2 id="exercice-1-1">Exercice 1</h2>
<pre><code class="language-matlab"><div>donnees_test;
<span class="hljs-comment">% % DegrŽ de la courbe de BŽzier utilisŽe comme modle (testez plusieurs valeurs de d entre 2 et 20) :</span>
degres = <span class="hljs-number">2</span>:<span class="hljs-number">5</span>:<span class="hljs-number">20</span>;
<span class="hljs-keyword">for</span> d=degres
beta_estime = moindres_carres(D_test,beta_0,beta_d,d);
y_estime = bezier(beta_0,beta_estime,beta_d,x);
<span class="hljs-built_in">plot</span>(x,y_estime,<span class="hljs-string">&#x27;MarkerSize&#x27;</span>,<span class="hljs-number">10</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">3</span>, <span class="hljs-string">&#x27;DisplayName&#x27;</span>, [<span class="hljs-string">&#x27;d=&#x27;</span>,num2str(d)]);
<span class="hljs-keyword">end</span>
</div></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_1_test.svg">
<h2 id="exercice-2-1">Exercice 2</h2>
<pre><code class="language-matlab"><div>donnees_test;
close all;
liste_d = <span class="hljs-number">2</span>:<span class="hljs-number">10</span>:<span class="hljs-built_in">length</span>(D_test);
liste_erreurs_apprentissage = [];
<span class="hljs-keyword">for</span> d = liste_d
erreur = erreur_apprentissage(D_test,beta_0,beta_d,d);
liste_erreurs_apprentissage = [liste_erreurs_apprentissage erreur];
<span class="hljs-keyword">end</span>
<span class="hljs-comment">% TracŽ de l&#x27;erreur d&#x27;apprentissage en fonction de d :</span>
<span class="hljs-built_in">figure</span>(<span class="hljs-string">&#x27;Name&#x27;</span>,<span class="hljs-string">&#x27;Erreur d&#x27;&#x27;apprentissage&#x27;</span>,<span class="hljs-string">&#x27;Position&#x27;</span>,[<span class="hljs-number">0.4</span>*L,<span class="hljs-number">0.05</span>*H,<span class="hljs-number">0.6</span>*L,<span class="hljs-number">0.7</span>*H]);
<span class="hljs-built_in">plot</span>(liste_d,liste_erreurs_apprentissage,<span class="hljs-string">&#x27;sb-&#x27;</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">2</span>);
set(gca,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">20</span>);
xlabel(<span class="hljs-string">&#x27;$d$&#x27;</span>,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
ylabel(<span class="hljs-string">&#x27;Erreur&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
<span class="hljs-built_in">legend</span>(<span class="hljs-string">&#x27; Erreur d&#x27;&#x27;apprentissage&#x27;</span>,<span class="hljs-string">&#x27;Location&#x27;</span>,<span class="hljs-string">&#x27;Best&#x27;</span>);
</div></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_2_test.svg">
<h1 id="exercice-3">Exercice 3</h1>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">erreur</span> = <span class="hljs-title">erreur_generalisation</span><span class="hljs-params">(D_test,D_app,beta_0,beta_d,d)</span></span>
X = D_test(<span class="hljs-number">1</span>,:)&#x27;;
Y = D_test(<span class="hljs-number">2</span>,:)&#x27;;
<span class="hljs-built_in">beta</span> = moindres_carres(D_app, beta_0, beta_d, d);
estimation = bezier(beta_0, <span class="hljs-built_in">beta</span>, beta_d, X);
erreur = <span class="hljs-built_in">mean</span>((estimation - Y).^<span class="hljs-number">2</span>);
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">[d_estime, sigma_estime]</span> = <span class="hljs-title">estimation_d_sigma</span><span class="hljs-params">(liste_d, liste_erreurs_generalisation)</span></span>
[~, index] = <span class="hljs-built_in">min</span>(liste_erreurs_generalisation);
d_estime = liste_d(index);
sigma_estime = std(liste_erreurs_generalisation);
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div>donnees_test;
close all;
<span class="hljs-comment">% Calcul de l&#x27;erreur d&#x27;apprentissage (risque empirique) :</span>
liste_d = <span class="hljs-number">2</span>:<span class="hljs-number">20</span>;
liste_erreurs_apprentissage = [];
<span class="hljs-keyword">for</span> d = liste_d
erreur = erreur_apprentissage(D_app,beta_0,beta_d,d);
liste_erreurs_apprentissage = [liste_erreurs_apprentissage erreur];
<span class="hljs-keyword">end</span>
<span class="hljs-comment">% Tracé de l&#x27;erreur d&#x27;apprentissage en fonction de d :</span>
<span class="hljs-built_in">figure</span>(<span class="hljs-string">&#x27;Name&#x27;</span>,<span class="hljs-string">&#x27;Erreur d&#x27;&#x27;apprentissage et erreur de generalisation&#x27;</span>,<span class="hljs-string">&#x27;Position&#x27;</span>,[<span class="hljs-number">0.4</span>*L,<span class="hljs-number">0.05</span>*H,<span class="hljs-number">0.6</span>*L,<span class="hljs-number">0.7</span>*H]);
<span class="hljs-built_in">plot</span>(liste_d,liste_erreurs_apprentissage,<span class="hljs-string">&#x27;sb-&#x27;</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">2</span>);
set(gca,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">20</span>);
xlabel(<span class="hljs-string">&#x27;$d$&#x27;</span>,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
ylabel(<span class="hljs-string">&#x27;Erreur&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
<span class="hljs-built_in">hold</span> on;
<span class="hljs-comment">% Calcul de l&#x27;erreur de généralisation (risque espéré) :</span>
liste_erreurs_generalisation = [];
<span class="hljs-keyword">for</span> d = liste_d
erreur = erreur_generalisation(D_test,D_app,beta_0,beta_d,d);
liste_erreurs_generalisation = [liste_erreurs_generalisation erreur];
<span class="hljs-keyword">end</span>
<span class="hljs-comment">% Tracé de l&#x27;erreur de généralisation en fonction de d :</span>
<span class="hljs-built_in">plot</span>(liste_d,liste_erreurs_generalisation,<span class="hljs-string">&#x27;sg-&#x27;</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">2</span>);
<span class="hljs-built_in">legend</span>(<span class="hljs-string">&#x27; Erreur d&#x27;&#x27;apprentissage&#x27;</span>,<span class="hljs-string">&#x27; Erreur de generalisation&#x27;</span>,<span class="hljs-string">&#x27;Location&#x27;</span>,<span class="hljs-string">&#x27;Best&#x27;</span>);
<span class="hljs-comment">% Estimation du degré d et de l&#x27;écart-type sigma :</span>
[d_estime,sigma_estime] = estimation_d_sigma(liste_d,liste_erreurs_generalisation);
fprintf(<span class="hljs-string">&#x27;Estimation du degre : d = %d\n&#x27;</span>,d_estime);
fprintf(<span class="hljs-string">&#x27;Estimation de l&#x27;&#x27;ecart-type du bruit sur les donnees : %.3f\n&#x27;</span>,sigma_estime);
</div></code></pre>
<pre><code><code><div>Estimation du degre : d = 5
Estimation de l'ecart-type du bruit sur les donnees : 0.477
</div></code></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_3.svg">
<h1 id="exercice-4">Exercice 4</h1>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">VC</span> = <span class="hljs-title">calcul_VC</span><span class="hljs-params">(D_app, beta_0, beta_d, d)</span></span>
X = D_app(<span class="hljs-number">1</span>,:)&#x27;;
Y = D_app(<span class="hljs-number">2</span>,:)&#x27;;
n = <span class="hljs-built_in">length</span>(X);
VC = <span class="hljs-number">0</span>;
<span class="hljs-keyword">for</span> <span class="hljs-built_in">j</span>=<span class="hljs-number">1</span>:n
D_app_loo = [D_app(:,<span class="hljs-number">1</span>:<span class="hljs-built_in">j</span><span class="hljs-number">-1</span>) , D_app(:,<span class="hljs-built_in">j</span>+<span class="hljs-number">1</span>:n)];
<span class="hljs-built_in">beta</span> = moindres_carres(D_app_loo, beta_0, beta_d, d);
estimation = bezier(beta_0, <span class="hljs-built_in">beta</span>, beta_d, X(<span class="hljs-built_in">j</span>));
VC = VC + (Y(<span class="hljs-built_in">j</span>) - estimation).^<span class="hljs-number">2</span>;
<span class="hljs-keyword">end</span>
VC = VC/n;
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">[d_estime,sigma_estime]</span> = <span class="hljs-title">estimation_d_sigma_bis</span><span class="hljs-params">(liste_d,liste_VC)</span></span>
[~, index] = <span class="hljs-built_in">min</span>(liste_VC);
d_estime = liste_d(index);
sigma_estime = std(liste_VC);
<span class="hljs-keyword">end</span>
</div></code></pre>
<pre><code class="language-matlab"><div>donnees_test;
close all;
<span class="hljs-comment">% Calcul de la validation croisée Leave-one-out :</span>
liste_d = <span class="hljs-number">2</span>:<span class="hljs-number">20</span>;
liste_VC = [];
tic;
<span class="hljs-keyword">for</span> d = liste_d
VC = calcul_VC(D_app,beta_0,beta_d,d);
liste_VC = [liste_VC VC];
<span class="hljs-keyword">end</span>
toc;
<span class="hljs-comment">% Tracé de la validation croisée Leave-one-out en fonction de d :</span>
<span class="hljs-built_in">figure</span>(<span class="hljs-string">&#x27;Name&#x27;</span>,<span class="hljs-string">&#x27;Validation croisee&#x27;</span>,<span class="hljs-string">&#x27;Position&#x27;</span>,[<span class="hljs-number">0.4</span>*L,<span class="hljs-number">0.05</span>*H,<span class="hljs-number">0.6</span>*L,<span class="hljs-number">0.7</span>*H]);
<span class="hljs-built_in">plot</span>(liste_d,liste_VC,<span class="hljs-string">&#x27;sr-&#x27;</span>,<span class="hljs-string">&#x27;LineWidth&#x27;</span>,<span class="hljs-number">2</span>);
set(gca,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">20</span>);
xlabel(<span class="hljs-string">&#x27;$d$&#x27;</span>,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
ylabel(<span class="hljs-string">&#x27;$VC$&#x27;</span>,<span class="hljs-string">&#x27;Interpreter&#x27;</span>,<span class="hljs-string">&#x27;Latex&#x27;</span>,<span class="hljs-string">&#x27;FontSize&#x27;</span>,<span class="hljs-number">30</span>);
<span class="hljs-comment">% Estimation du degré d et de l&#x27;écart-type sigma :</span>
[d_estime,sigma_estime] = estimation_d_sigma_bis(liste_d,liste_VC);
fprintf(<span class="hljs-string">&#x27;Estimation du degre : d = %d\n&#x27;</span>,d_estime);
fprintf(<span class="hljs-string">&#x27;Estimation de l&#x27;&#x27;ecart-type du bruit sur les donnees : %.3f\n&#x27;</span>,sigma_estime);
</div></code></pre>
<pre><code><code><div>Estimation du degre : d = 5
Estimation de l'ecart-type du bruit sur les donnees : 0.563
</div></code></code></pre>
<img src="file:////home/lfainsin/2A/TDAV/TP1/rapport/exercice_4.svg">
<h1 id="exercice-5-optionnel">Exercice 5 (Optionnel)</h1>
<pre><code class="language-matlab"><div>clear;
close all;
<span class="hljs-comment">% constantes</span>
beta_0 = <span class="hljs-number">115</span>;
beta_d = <span class="hljs-number">123</span>;
<span class="hljs-built_in">beta</span> = [<span class="hljs-number">133</span>,<span class="hljs-number">96</span>,<span class="hljs-number">139</span>,<span class="hljs-number">118</span>];
n_app = <span class="hljs-number">100</span>;
pas_app = <span class="hljs-number">1</span>/(n_app<span class="hljs-number">-1</span>);
x_j = <span class="hljs-number">0</span>:pas_app:<span class="hljs-number">1</span>;
sigma = <span class="hljs-number">0.5</span>;
d = <span class="hljs-number">5</span>;
n = <span class="hljs-number">10000</span>;
beta_moyen = <span class="hljs-built_in">zeros</span>(<span class="hljs-number">1</span>, d<span class="hljs-number">-1</span>)&#x27;;
sigma_moyen = <span class="hljs-number">0</span>;
<span class="hljs-keyword">for</span> <span class="hljs-built_in">i</span>=<span class="hljs-number">1</span>:n
<span class="hljs-comment">% génération de nouveaux points d&#x27;apprentissage</span>
y_j = bezier_bruitee(beta_0,<span class="hljs-built_in">beta</span>,beta_d,x_j,sigma);
D_app = [x_j ; y_j];
beta_estime = moindres_carres(D_app,beta_0,beta_d,d);
beta_moyen = beta_moyen + beta_estime/n;
<span class="hljs-keyword">end</span>
[beta&#x27; , beta_moyen]
</div></code></pre>
<pre><code class="language-matlab"><div>&gt;&gt; exercice_5
<span class="hljs-built_in">ans</span> =
<span class="hljs-number">133.0000</span> <span class="hljs-number">133.0007</span>
<span class="hljs-number">96.0000</span> <span class="hljs-number">96.0013</span>
<span class="hljs-number">139.0000</span> <span class="hljs-number">138.9989</span>
<span class="hljs-number">118.0000</span> <span class="hljs-number">118.0024</span>
</div></code></pre>
</body>
</html>