<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>Hi Pierre-Aimé,</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>Thank you for your help!</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica
Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>All best,</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>Reinaldo. </span></div><div><br></div> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">De:</span></b> Pierre-Aimé Agnel <pierre-aime.agnel@scilab-enterprises.com><br> <b><span style="font-weight: bold;">Para:</span></b> Reinaldo <rei.listas@yahoo.com>; International users mailing list for Scilab.
<users@lists.scilab.org> <br> <b><span style="font-weight: bold;">Enviadas:</span></b> Terça-feira, 24 de Junho de 2014 4:36<br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: [Scilab-users] I have problem to plot a graph of the trigonometric function.<br> </font> </div> <div class="y_msg_container"><br><div id="yiv8107582267"><div>
Hi,<br clear="none">
<br clear="none">
You should use the element-wise multiplication <font face="Courier New, Courier, monospace">.*<font face="Helvetica, Arial, sans-serif"> <font face="sans-serif">instead of the matrix multiplication
* in your function f = x * sin(x)<br clear="none">
You also had a missing property "color" in the function title
(and I modified your xdata to be between -5 and 5)<br clear="none">
<br clear="none">
</font></font><small>// Close all opened figures and clear
workspace<br clear="none">
//xdel(winsid());<br clear="none">
clear;<br clear="none">
clc;<br clear="none">
<br clear="none">
function f=myfunction(x)<br clear="none">
f = x.*sin(x)<br clear="none">
endfunction<br clear="none">
<br clear="none">
// Plot<br clear="none">
scf(1);<br clear="none">
clf(1);<br clear="none">
<br clear="none">
xdata = linspace ( -5 , 5 , 100 );<br clear="none">
ydata = myfunction ( xdata );<br clear="none">
plot ( xdata , ydata );<br clear="none">
xlabel("$-5\le x\le 5$","fontsize",4,"color","red");<br clear="none">
ylabel("y = x . sin(x)","fontsize",4,"color","red");<br clear="none">
title("Function","color", "red","fontsize",4);<br clear="none">
legend("Function evaluation");</small><br clear="none">
<br clear="none">
Best<br clear="none">
<div class="qtdSeparateBR"><br><br></div><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd37653"><br clear="none">
</div></font><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd70065">On 06/23/2014 10:56 PM, Reinaldo wrote:<br clear="none">
</div><blockquote type="cite"><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd41133">
</div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd29632">
<div class="yiv8107582267" style="">Hi Scilab users,</div>
<div class="yiv8107582267" style=""><br clear="none" class="yiv8107582267" style="">
</div>
<div class="yiv8107582267" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;">I have a problem to plot a graph
of the trigonometric function, as follows:</div>
<div class="yiv8107582267" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br clear="none" class="yiv8107582267" style="">
</div>
<pre class="yiv8107582267" style="font-family: Monospaced;"><span class="yiv8107582267" style="color:rgb(100,174,100);font-style:italic;">// Close all opened figures and clear workspace</span>
<span class="yiv8107582267" style="color:rgb(100,174,100);font-style:italic;">//xdel(winsid());</span>
<span class="yiv8107582267" style="color:rgb(50,185,185);">clear</span>;
<span class="yiv8107582267" style="color:rgb(50,185,185);">clc</span>;
<span class="yiv8107582267" style="color:rgb(176,24,19);">function</span> <span class="yiv8107582267" style="color:rgb(131,67,16);font-weight:bold;">f</span><span class="yiv8107582267" style="color:rgb(92,92,92);">=</span><span class="yiv8107582267" style="text-decoration:underline;">myfunction</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(131,67,16);font-weight:bold;">x</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>
<span class="yiv8107582267" style="color:rgb(131,67,16);font-weight:bold;">f</span> <span class="yiv8107582267" style="color:rgb(92,92,92);">=</span> <span class="yiv8107582267" style="color:rgb(131,67,16);font-weight:bold;">x</span><span class="yiv8107582267" style="color:rgb(92,92,92);">*</span><span class="yiv8107582267" style="color:rgb(50,185,185);">sin</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(131,67,16);font-weight:bold;">x</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>
<span class="yiv8107582267" style="color:rgb(176,24,19);">endfunction</span>
<span class="yiv8107582267" style="color:rgb(100,174,100);font-style:italic;">// Plot</span>
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">scf</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">1</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">clf</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">1</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
xdata <span class="yiv8107582267" style="color:rgb(92,92,92);">=</span> <span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">linspace</span> <span class="yiv8107582267" style="color:rgb(74,85,219);">(</span> <span class="yiv8107582267" style="color:rgb(92,92,92);">-</span><span class="yiv8107582267" style="color:rgb(188,143,143);">10</span> , <span class="yiv8107582267" style="color:rgb(188,143,143);">10</span> , <span class="yiv8107582267" style="color:rgb(188,143,143);">100</span> <span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
ydata <span class="yiv8107582267" style="color:rgb(92,92,92);">=</span> <span class="yiv8107582267" style="text-decoration:underline;">myfunction</span> <span class="yiv8107582267" style="color:rgb(74,85,219);">(</span> xdata <span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">plot</span> <span class="yiv8107582267" style="color:rgb(74,85,219);">(</span> xdata , ydata <span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">xlabel</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">$-5\le x\le 5$</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">fontsize</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">4</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">color</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267"
style="color:rgb(188,143,143);">red</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">ylabel</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">y = x . sin(x)</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">fontsize</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">4</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">color</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267"
style="color:rgb(188,143,143);">red</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">title</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">Function</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">red</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">fontsize</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span>,<span class="yiv8107582267" style="color:rgb(188,143,143);">4</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;
<span class="yiv8107582267" style="color:rgb(174,92,176);text-decoration:underline;">legend</span><span class="yiv8107582267" style="color:rgb(74,85,219);">(</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(188,143,143);">Function evaluation</span><span class="yiv8107582267" style="color:rgb(188,143,143);">"</span><span class="yiv8107582267" style="color:rgb(74,85,219);">)</span>;</pre>
<pre class="yiv8107582267"><font face="HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space:normal;">Could someone tell me what's wrong?</span></font></pre>
<pre class="yiv8107582267"><font face="HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space:normal;">Thank you in advance.</span></font></pre>
<pre class="yiv8107582267"><font face="HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space:normal;">All best,</span></font></pre>
<pre class="yiv8107582267"><font face="HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space:normal;">Reinaldo.</span></font></pre></div>
</div>
<br clear="none">
<fieldset class="yiv8107582267mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
users mailing list
<a rel="nofollow" shape="rect" class="yiv8107582267moz-txt-link-abbreviated" ymailto="mailto:users@lists.scilab.org" target="_blank" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a rel="nofollow" shape="rect" class="yiv8107582267moz-txt-link-freetext" target="_blank" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br clear="none">
<pre class="yiv8107582267moz-signature">--
Pierre-Aimé Agnel
Development Team
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
<a rel="nofollow" shape="rect" class="yiv8107582267moz-txt-link-freetext" target="_blank" href="http://www.scilab-enterprises.com/">http://www.scilab-enterprises.com</a><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd33711"> </div></pre><div class="yiv8107582267yqt8980363492" id="yiv8107582267yqtfd93618">
</div></div></div><br><br></div> </div> </div> </div></body></html>