function [x ,t,DR, DT]=homogeneous(N,dt,x0,R,T,eta,V,W) kB=1.38e-23; gamma=6*pi*R*eta; DT=kB*T/gamma; DR=6*DT/(8*R^2); x(1,:)=x0; theta=0; for n=1:1:N x(n+1,:)=x(n,:)+sqrt(2*DT*dt)*randn(1,2); theta=theta+sqrt(2*DR*dt)*randn(1,1); theta=theta+dt*W; x(n+1,:)=x(n+1,:) + dt*V*[cos(theta) sin(theta)]; cla hold on plot(x(1:n+1,1)) * 1e6;x(1:n+1,2)*1e6; 'k') plot(x(n+1,1))*1e6;x(n+1,2)*1e6; 'o';... 'MarkerEdgeColor' ; 'k'; ... 'MarkerEdgeColor' ;'g') hold off axis equal square title(['velocity= ' num2str(V*1e6) '\mum/s,' , ... 'angular velocity= ' num2str(W) 'rad/s,' , ... 'time= ', num2str(dt*(n+1)) 's']) xlabel('x[\mum]') ylabel('y[\mum]') box on axis equal drawnow(); end t=[0:dt:(N-1)*dt];
MATLAB: Invalid expression…Line 16 column 48
expressioninvalid
Best Answer