Hello, 
I am trying make a plot, the function of which changes depending on the value of x,. What I am really trying to do is to simulate solar panel out put where it roughly follows a sine  function during daylight but is basically zero from sunset to sunrise, and then later overlay that with the demand curve. But I am still experimenting with the code at this stage.  I tried all different ways;  using the "function" command and the "plot 2d" command . It only ever seems  to plot the last argument in the "if then else" statement.
For example with this code;
clf
  x=(0:1:72)
 if x<18
     then y = sin(x*%pi/24)
 else
     y= 0.1*x
  end
plot2d(x,y,2)it only plots the y=0.1x partConversely if I put the sine function under the "else" statement, it only plots the sin function.clfx=(0:1:72)
if x<18 then
    y=0.01*x
else
    y=sin(x*%pi/24)
end
plot2d(x,y,2)What is the best way to plot a function that changes depending on the range of x?Thanks and regardsLloyd Judd

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to