[Scilab-users] I have problem to plot a graph of the trigonometric function.

Reinaldo rei.listas at yahoo.com
Tue Jun 24 17:07:53 CEST 2014


Hi Pierre-Aimé,

Thank you for your help!

All best,
Reinaldo. 


________________________________
 De: Pierre-Aimé Agnel <pierre-aime.agnel at scilab-enterprises.com>
Para: Reinaldo <rei.listas at yahoo.com>; International users mailing list for Scilab. <users at lists.scilab.org> 
Enviadas: Terça-feira, 24 de Junho de 2014 4:36
Assunto: Re: [Scilab-users] I have problem to plot a graph of the trigonometric function.
 


Hi,

You should use the element-wise multiplication .*instead of the matrix multiplication * in your function f = x * sin(x)
You also had a missing property "color" in the function title
          (and I modified your xdata to be between -5 and 5)

// Close all opened figures and clear workspace
//xdel(winsid());
clear;
clc;

function f=myfunction(x)
f = x.*sin(x)
endfunction

// Plot
scf(1);
clf(1);

xdata = linspace ( -5 , 5 , 100 );
ydata = myfunction ( xdata );
plot ( xdata , ydata );
xlabel("$-5\le x\le 5$","fontsize",4,"color","red");
ylabel("y = x . sin(x)","fontsize",4,"color","red");
title("Function","color", "red","fontsize",4);
legend("Function evaluation");

Best




On 06/23/2014 10:56 PM, Reinaldo wrote:

Hi Scilab users,
>
>
>I have a problem to plot a graph of the trigonometric function, as follows:
>
>
>// Close all opened figures and clear workspace //xdel(winsid()); clear; clc; function f=myfunction(x) f = x*sin(x) endfunction // Plot scf(1); clf(1); xdata = linspace ( -10 , 10 , 100 );
ydata = myfunction ( xdata ); plot ( xdata , ydata ); xlabel("$-5\le x\le 5$","fontsize",4,"color","red"); ylabel("y = x . sin(x)","fontsize",4,"color","red"); title("Function","red","fontsize",4); legend("Function evaluation");
>Could someone tell me what's wrong?
>Thank you in advance.
>All best,
>Reinaldo.
>
>
>_______________________________________________
users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users 

-- 
Pierre-Aimé Agnel
Development Team
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140624/84504903/attachment.htm>


More information about the users mailing list