[solved]Scilab: Plot in a loop

Need help with C, C++, perl, python, etc?

[solved]Scilab: Plot in a loop

hi guys,
I want to know how to plot in a loop. This is my code
Code: Select all
`clcclear allfor x=1:0.5:10    y=x+1    printf("\n the value of y:%f",y) plot(x,y)end`

the plot only shows the axes. This is my output.

http://i.imgur.com/2mZQEhL.png
Last edited by Lecram on 2016-08-14 07:07, edited 5 times in total.

Lecram

Posts: 95
Joined: 2009-06-03 08:54
Location: India

Re: Scilab: Plot in a loop

As a courtesy to folks who have metered/limited bandwidth, please thumbnail your images. Those bandwidth-guzzling fullscreen images add up fast.

dasein

Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Scilab: Plot in a loop

Thanks for the reminder dasein

Lecram

Posts: 95
Joined: 2009-06-03 08:54
Location: India

Re: Scilab: Plot in a loop

Hi , i saw it's an old post but however
This is the solution to your problem:
/*
clear all
x=[] // Declare empty matrix
y=[] // Declare empty matrix
for i=1:0.5:100
x(1,i)=i // take the i-th column
y(1,i)=x(i)+1
plot(x,y) //plot them
end
*/

If you want to calculate something really big , you can make a "if" control statement which can take out some numbers from your matrices so it's light to plot.
Hope that helps ; )
den4oman

Posts: 13
Joined: 2016-04-07 22:35

Re: Scilab: Plot in a loop

Thanks it really works.

Lecram

Posts: 95
Joined: 2009-06-03 08:54
Location: India