Friday, June 12, 2009

Plotting vectors like an animation

The last post received a comment, so I thought the readers could like to see anything more about how to plot vectors.

Let's use the Scilab's text editor, click the 'Editor' button and write the scripts, look the images.

Opening the editor.


Using the editor.

Read the buttons for use the editor's resources.

Now, let's see what happens when the following script is executed:

r = 0.1:0.1:10;

w = %pi/10;

x_i = 0;
y_i = 0;
for t = 1:length(r),
x_f = r(t)*cos(w*t);
y_f = r(t)*sin(w*t);

champ(x_i, y_i, x_f - x_i, y_f - y_i, 0.1);

x_i = x_f;
y_i = y_f;

sleep(100);
end;

--------------
The result:

2 comments:

Anonymous said...

Hello!

Thanks for the Scilab tip - I was trying to simulate an inverted pendulum and this is exactly what I need!

I'll add your website to my favourites.

SSS said...

Thanks. very clear.