Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[solved]Scilab: Plot in a loop

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
Lecram
Posts: 120
Joined: 2009-06-03 08:54

[solved]Scilab: Plot in a loop

#1 Post by Lecram »

hi guys,
I want to know how to plot in a loop. This is my code

Code: Select all

clc
clear all
for 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.
Image
http://i.imgur.com/2mZQEhL.png
Last edited by Lecram on 2016-08-14 07:07, edited 5 times in total.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Scilab: Plot in a loop

#2 Post by dasein »

Not pertinent to your problem, but pertinent to your post...

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

User avatar
Lecram
Posts: 120
Joined: 2009-06-03 08:54

Re: Scilab: Plot in a loop

#3 Post by Lecram »

Thanks for the reminder dasein

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

Re: Scilab: Plot in a loop

#4 Post by den4oman »

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 ; )

User avatar
Lecram
Posts: 120
Joined: 2009-06-03 08:54

Re: Scilab: Plot in a loop

#5 Post by Lecram »

Thanks it really works.

Post Reply