March 28th, 2006
if you have matlab, try this awesome simulation of Brownian Motion!!!!! I was... researching how to include animation for my final project but had to try this out. It kicks ass!
n = 20
s = 0.2
nframes = 50;
x = rand(n,1) -0.5;
y = rand(n,1) -0.5;
h = plot(x,y,'.');
set(h,'MarkerSize',18);
axis([-1 1 -1 1])
axis square
grid off
for k= 1:nframes
x = x + s*randn(n,1);
y = y + s*randn(n,1);
set(h, 'XData', x, 'YData', y)
M(k) = getframe;
end
movie(M,30)
n = 20
s = 0.2
nframes = 50;
x = rand(n,1) -0.5;
y = rand(n,1) -0.5;
h = plot(x,y,'.');
set(h,'MarkerSize',18);
axis([-1 1 -1 1])
axis square
grid off
for k= 1:nframes
x = x + s*randn(n,1);
y = y + s*randn(n,1);
set(h, 'XData', x, 'YData', y)
M(k) = getframe;
end
movie(M,30)
- Mood:
curious
% How to Keep an Idiot Busy in Matlab
b = uicontrol('Style', 'pushbutton', 'Units', 'normalized', 'Position',[.5 .5 .2 .1], 'String', 'Click Me!');
s = 'set(b, ''Position'',[0.8*rand 0.9*rand .2 .1])';
k = 1000;
while k >0
eval(s);
pause(1);
k = k-1;
end
set(b,'Callback',s);
b = uicontrol('Style', 'pushbutton', 'Units', 'normalized', 'Position',[.5 .5 .2 .1], 'String', 'Click Me!');
s = 'set(b, ''Position'',[0.8*rand 0.9*rand .2 .1])';
k = 1000;
while k >0
eval(s);
pause(1);
k = k-1;
end
set(b,'Callback',s);
- Mood:
amused
I'm trying to plot lines in matlab on a graph. I come up with these complex x and y matrices with like 10 points.
Question Folks: How many points are required to make a line? - Two
Good grief. I need HELP
Question Folks: How many points are required to make a line? - Two
Good grief. I need HELP
