<div dir="ltr"><div><div><div>Hi Samuel:<br><br></div>I'd like to understand the "$" inside the would mean from the script?<br><br></div>Thanks,<br></div>Berns B.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Jan 27, 2013 at 12:46 AM, Samuel Gougeon <span dir="ltr"><<a href="mailto:sgougeon@free.fr" target="_blank">sgougeon@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Le 26/01/2013 17:00, constantina a
écrit :<br>
</div><div class="im">
<blockquote type="cite">
<pre>Sorry, I know is a basic question, i now the answer in matlab but not in
scilab.... What is the function that let me find "peaks " in a matrix and
the position of the peaks??? </pre>
</blockquote></div>
Here is a possible solution, including peaks on the borders:<br>
<small><font face="Courier New, Courier, monospace"><br>
m = rand(6,6)<br>
M = [m(2,:) ; m ; m($-1,:) ];<br>
M = [M(:,2) M M(:,$-1)];<br>
pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) &
M(2:$-1,2:$-1)>M(3:$,2:$-1);<br>
pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) &
M(2:$-1,2:$-1)>M(2:$-1,3:$);<br>
isPeak = pC & pR<br>
find(isPeak) // returns linearized indices of peaks<br>
m(~isPeak) = 0 // to show only peaks<br>
</font></small><br>
giving:<br>
<br>
<small><font face="Courier New, Courier, monospace">-->m =
rand(6,6)<br>
m =<br>
0.0437334 0.7783129 0.8415518 0.5618661
0.3873779 0.2615761 <br>
0.4818509 0.2119030 0.4062025 0.5896177
0.9222899 0.4993494 <br>
0.2639556 0.1121355 0.4094825 0.6853980
0.9488184 0.2638578 <br>
0.4148104 0.6856896 0.8784126 0.8906225
0.3435337 0.5253563 <br>
0.2806498 0.1531217 0.1138360 0.5042213
0.3760119 0.5376230 <br>
0.1280058 0.6970851 0.1998338 0.3493615
0.7340941 0.1199926 <br>
<br>
-->M = [m(2,:) ; m ; m($-1,:) ];<br>
-->M = [M(:,2) M M(:,$-1)];<br>
-->pC = M(2:$-1,2:$-1)>M(1:$-2,2:$-1) &
M(2:$-1,2:$-1)>M(3:$,2:$-1);<br>
-->pR = M(2:$-1,2:$-1)>M(2:$-1,1:$-2) &
M(2:$-1,2:$-1)>M(2:$-1,3:$);<br>
-->isPeak = pC & pR<br>
isPeak =<br>
F F T F F F <br>
T F F F F F <br>
F F F F T F <br>
F F F T F F <br>
F F F F F T <br>
F T F F T F <br>
<br>
-->find(isPeak) // returns linearized indices of peaks<br>
ans =<br>
2. 12. 13. 22. 27. 30. 35. <br>
<br>
-->m(~isPeak) = 0 // to show only peaks<br>
m =<br>
0. 0. 0.8415518 0.
0. 0. <br>
0.4818509 0. 0. 0.
0. 0. <br>
0. 0. 0. 0.
0.9488184 0. <br>
0. 0. 0. 0.8906225
0. 0. <br>
0. 0. 0. 0.
0. 0.5376230 <br>
0. 0.6970851 0. 0.
0.7340941 0. <br>
<br>
<br>
</font><big>Regards<span class="HOEnZb"><font color="#888888"><br>
Samuel<br>
</font></span></big><font face="Courier New, Courier, monospace"> <br>
</font></small><br>
</div>
<br>_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>