[Scilab-users] help a newbie out?

Radovan Omorjan omorr at uns.ac.rs
Sat Jan 4 23:03:54 CET 2014


Hello,

The point is in division, if you want do do everything elementwise 
(expression concerning every element of a vector t), pay attention the 
difference between / and ./ . These two are totally different operators.

y = (m*p) ./ (p + (m - p)*exp(-k*m*t));

Moreover, it is not advisable to use [ ] where you need ( )

Regards,
Radovan

On 1/4/2014 10:19 PM, Ryan M. Castle wrote:
> Hello. I am new to scilab. I need to create a simple plot of the solution to the logistic equation and have been frustrated by scilab. The plot should be decaying, approaching 20 with an initial population of 300. Here is what I have (in .sce file):
>
> clc
> clear
> p = 300;
> m = 20;
> k = .1;
> t = [0:.01:5];
>
> y = (m*p)/[p + (m - p)*exp(-k*m*t)];
>
> plot(t, y, 'LineWidth',3)
> xlabel('t'),ylabel('y');
>
>
> If I define just  t=0 then I get correct result of 300. If I have t=5 I get (close to) 20. All good.
>
> But when I plot t=0:.01:5; I get a plot that is 1) increasing not decreasing and 2) the initial and limiting values are all wrong, just a fraction of correct values.
>
> What am I missing? Such a simple plot...
>   
> Thank you. 		 	   		
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>


---
U ovoj e-pošti nema virusa i zlonamjernih programa jer je aktivna avast! antivirusna zaštita.
http://www.avast.com




More information about the users mailing list