<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:Monospaced;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
color:black;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello Stéphane,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Tried optim using a true L1-norm on your script.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>It seems to work but results are not necessarily better than your previous srqt trick:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#B01813'>function</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><u><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>resid</span></u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>x</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>y</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>z</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>sum</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>abs</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>z</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>-</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>2</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>*</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>x</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>3</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>*</span><b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#834310'>y</span></b><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)))</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#B01813'>endfunction</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>n</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>10</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>x,y</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>]</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#AE5CB0'>meshgrid</span></u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#AE5CB0'>linspace</span></u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>-</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>,</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>,n</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>))</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>x</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>y</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>rand</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>x,</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>'normal'</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>/</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>10</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>n,n</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>100</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#64AE64'>// outlier</span></i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>5</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>,</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>5</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>-</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>200</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#64AE64'>// outlier</span></i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#64AE64'>// L2 case</span></i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>A</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>x</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>^</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>x</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>y</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)]</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>coefl2</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>A</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>\</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>disp</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>coefl2</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#64AE64'>// L1 case</span></i><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>coef0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:rosybrown'>0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>]</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>r,coefl1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>]</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'> </span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>optim</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>list</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><u><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#AE5CB0'>NDcost</span></u><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>,<u>resid</u>,x,y,z</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>,coef0</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#32B9B9'>disp</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>coefl1</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.5pt;font-family:"Monospaced","serif"'>;</span><span style='font-size:7.5pt;font-family:"Monospaced","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Rgds<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Rafael<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> users-bounces@lists.scilab.org [mailto:users-bounces@lists.scilab.org] <b>On Behalf Of </b>Stéphane Mottelet<br><b>Sent:</b> Monday, March 04, 2013 3:06 PM<br><b>To:</b> users@lists.scilab.org<br><b>Subject:</b> Re: [Scilab-users] Surface smoothing in Scilab, immune to outliers<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hello,<br><br>I have written a little script making the comparison between L1 and L2 norm. For the L1 case, I have used leastsq and cheated by returning the square root of the abs of the residue and the 'nd' option. <o:p></o:p></p><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#B01813'>function</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'> </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><u><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>resid</span></u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>x</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>y</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>, </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>z</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'> </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>sqrt</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>abs</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>z</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>-</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>2</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>*</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>x</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>+</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>coef</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>3</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>*</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>y</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)))</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'> </span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#834310'>r</span></b><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#B01813'>endfunction</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p> </o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>n</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>10</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>x,y</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>]</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#AE5CB0'>meshgrid</span></u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#AE5CB0'>linspace</span></u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>-</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>,</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>,n</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>))</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>x</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>y</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>+</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>rand</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>x,</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>'normal'</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>/</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>10</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>n,n</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>20</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>; // outlier<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p> </o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>// L2 case<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p> </o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>A</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>x</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>^</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>0</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'> x</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'> y</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)]</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>coefl2</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>A</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>\</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>z</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#FFAA00'>:</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>disp</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>coefl2</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p> </o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>// L1 case<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p> </o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>[</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>l1norm,coefl1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>]</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#5C5C5C'>=</span><u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#AE5CB0'>leastsq</span></u><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>list</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><u><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>resid</span></u><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>,x,y,z</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>,coefl2,</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>'</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'><o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:rosybrown'>nd'</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><pre><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#32B9B9'>disp</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>(</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>coefl1</span><span style='font-size:7.0pt;font-family:"Monospaced","serif";color:#4A55DB'>)</span><span style='font-size:7.0pt;font-family:"Monospaced","serif"'>;<o:p></o:p></span></pre><p class=MsoNormal><br>Things are not supposed to work so well because 'nd' is only meaning that the function to minimize in non-differentiable at the optimum (and only there....). However, it seems to work well (true value is [1,1,1]') :<br><br>L2 case :<br><br> 1.165072 <br> 1.4380897 <br> 1.398408 <br> <br>L1 case :<br><br> 0.9954939 <br> 1.0441875 <br> 0.9939874 <br><br>S.<br><br>Le 04/03/13 18:51, Rafael Guerra a écrit :<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Thanks Stéphane for the useful L1-references and for the insight on<o:p></o:p></pre><pre>iterative L2 methods and to the others for their repplies.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>PS:<o:p></o:p></pre><pre>Strong outliers or spikes have infinite bandwidth and therefore bandpass<o:p></o:p></pre><pre>filtering/convolution does not seem, a priori, to be the most effective<o:p></o:p></pre><pre>method to remove them.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Regards,<o:p></o:p></pre><pre>Rafael<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>-----Original Message-----<o:p></o:p></pre><pre>From: <a href="mailto:users-bounces@lists.scilab.org">users-bounces@lists.scilab.org</a> [<a href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>]<o:p></o:p></pre><pre>On Behalf Of Stéphane Mottelet<o:p></o:p></pre><pre>Sent: Monday, March 04, 2013 10:14 AM<o:p></o:p></pre><pre>To: <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><o:p></o:p></pre><pre>Subject: Re: [Scilab-users] Surface smoothing in Scilab, immune to outliers<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Hello,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Replacing the squared L2 norm by the L1 norm in the linear regression gives<o:p></o:p></pre><pre>a good robustness to outliers (cf. Donoho and al. papers). The problem is<o:p></o:p></pre><pre>then non differentiable but you can implement it by iteratively reweighting<o:p></o:p></pre><pre>the classical L2 method (IRLS method), or by writing an equivalent linear<o:p></o:p></pre><pre>program.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>S.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>Le 04/03/13 13:23, Dang, Christophe a écrit :<o:p></o:p></pre><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Hello,<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>De la part de Rafael Guerra<o:p></o:p></pre><pre>Envoyé : lundi 4 mars 2013 04:37<o:p></o:p></pre><pre><o:p> </o:p></pre><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Does somebody know if there are Scilab functions [...] that smooths <o:p></o:p></pre><pre>experimental data z=f(x,y) and is immune to strong outliers.<o:p></o:p></pre></blockquote><pre>imho, the problem with smoothing and outliers is that the definition <o:p></o:p></pre><pre>of a outlier depends on the field.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>How can Scilab know what a "strong outlier" is?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>I personally would try Fourier filtering:<o:p></o:p></pre><pre>a strong outlier means a steep slope<o:p></o:p></pre><pre>and therefore correspond to a high frequency.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Thus fft2, set high frequencies to 0<o:p></o:p></pre><pre>(with possibly a smooth transition),<o:p></o:p></pre><pre>then inverse fft2 -- ifft2 does not exist, I never used 2-dimension <o:p></o:p></pre><pre>Fourier transform so I don't know if the inverse is easy to perform...<o:p></o:p></pre><pre><o:p> </o:p></pre></blockquote><pre><o:p> </o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>users mailing list<o:p></o:p></pre><pre><a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><o:p></o:p></pre><pre><a href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>users mailing list<o:p></o:p></pre><pre><a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><o:p></o:p></pre><pre><a href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre></blockquote><p class=MsoNormal><o:p> </o:p></p></div></body></html>