<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
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>
You also had a missing property "color" in the function title
(and I modified your xdata to be between -5 and 5)<br>
<br>
</font></font><small>// Close all opened figures and clear
workspace<br>
//xdel(winsid());<br>
clear;<br>
clc;<br>
<br>
function f=myfunction(x)<br>
f = x.*sin(x)<br>
endfunction<br>
<br>
// Plot<br>
scf(1);<br>
clf(1);<br>
<br>
xdata = linspace ( -5 , 5 , 100 );<br>
ydata = myfunction ( xdata );<br>
plot ( xdata , ydata );<br>
xlabel("$-5\le x\le 5$","fontsize",4,"color","red");<br>
ylabel("y = x . sin(x)","fontsize",4,"color","red");<br>
title("Function","color", "red","fontsize",4);<br>
legend("Function evaluation");</small><br>
<br>
Best<br>
<br>
</font>On 06/23/2014 10:56 PM, Reinaldo wrote:<br>
<blockquote
cite="mid:1403556993.75985.YahooMailNeo@web121602.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:10pt">
<div class="" style="">Hi Scilab users,</div>
<div class="" style=""><br class="" style="">
</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;" class="">I have a problem to plot a graph
of the trigonometric function, as follows:</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;" class=""><br class="" style="">
</div>
<pre style="font-family: Monospaced;" class=""><span style="color:rgb(100,174,100);font-style:italic;" class="">// Close all opened figures and clear workspace</span>
<span style="color:rgb(100,174,100);font-style:italic;" class="">//xdel(winsid());</span>
<span style="color:rgb(50,185,185);" class="">clear</span>;
<span style="color:rgb(50,185,185);" class="">clc</span>;
<span style="color:rgb(176,24,19);" class="">function</span> <span style="color:rgb(131,67,16);font-weight:bold;" class="">f</span><span style="color:rgb(92,92,92);" class="">=</span><span style="text-decoration: underline;" class="">myfunction</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(131,67,16);font-weight:bold;" class="">x</span><span style="color:rgb(74,85,219);" class="">)</span>
<span style="color:rgb(131,67,16);font-weight:bold;" class="">f</span> <span style="color:rgb(92,92,92);" class="">=</span> <span style="color:rgb(131,67,16);font-weight:bold;" class="">x</span><span style="color:rgb(92,92,92);" class="">*</span><span style="color:rgb(50,185,185);" class="">sin</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(131,67,16);font-weight:bold;" class="">x</span><span style="color:rgb(74,85,219);" class="">)</span>
<span style="color:rgb(176,24,19);" class="">endfunction</span>
<span style="color:rgb(100,174,100);font-style:italic;" class="">// Plot</span>
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">scf</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">1</span><span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">clf</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">1</span><span style="color:rgb(74,85,219);" class="">)</span>;
xdata <span style="color:rgb(92,92,92);" class="">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;" class="">linspace</span> <span style="color:rgb(74,85,219);" class="">(</span> <span style="color:rgb(92,92,92);" class="">-</span><span style="color:rgb(188,143,143);" class="">10</span> , <span style="color:rgb(188,143,143);" class="">10</span> , <span style="color:rgb(188,143,143);" class="">100</span> <span style="color:rgb(74,85,219);" class="">)</span>;
ydata <span style="color:rgb(92,92,92);" class="">=</span> <span style="text-decoration: underline;" class="">myfunction</span> <span style="color:rgb(74,85,219);" class="">(</span> xdata <span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">plot</span> <span style="color:rgb(74,85,219);" class="">(</span> xdata , ydata <span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">xlabel</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">$-5\le x\le 5$</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">fontsize</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">4</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">color</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">red</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">ylabel</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">y = x . sin(x)</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">fontsize</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">4</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">color</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">red</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">title</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">Function</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">red</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">fontsize</span><span style="color:rgb(188,143,143);" class="">"</span>,<span style="color:rgb(188,143,143);" class="">4</span><span style="color:rgb(74,85,219);" class="">)</span>;
<span style="color:rgb(174,92,176);text-decoration:underline;" class="">legend</span><span style="color:rgb(74,85,219);" class="">(</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(188,143,143);" class="">Function evaluation</span><span style="color:rgb(188,143,143);" class="">"</span><span style="color:rgb(74,85,219);" class="">)</span>;</pre>
<pre class=""><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=""><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=""><font face="HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space: normal;">All best,</span></font></pre>
<pre class=""><font face="HelveticaNeue, Helvetica
Neue, Helvetica, Arial, Lucida Grande, sans-serif"><span style="white-space: normal;">Reinaldo.</span></font></pre>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Pierre-Aimé Agnel
Development Team
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a> </pre>
</body>
</html>