Hey, I have this code and have been using the comet function to animate each line. I want to animate all of the at the same time but have not been able to do so… Anybody have ideas?
clear all% Initial Values
m = 1.6e-27;%(Kg)
m1 = 1.04e-25;m2 = 1.04e-26;d = 0.1; %cm
q = 1.6e-19; %(C)
v = 2e5; %(m/s)
B = 0.01; %Kg/(C)(s)
%Formulas
r= m*v/(B*q);%m
r1= m1*v/(B*q);r2= m2*v/(B*q);%Angle
Theta_max = acosd(1-d/(2*r));Theta_max1 = acosd(1-d/(2*r1));Theta_max2 = acosd(1-d/(2*r2));%Point of Impact
x_max= r*sind(Theta_max); %mx_max1= r1*sind(Theta_max1); %mx_max2= r2*sind(Theta_max2); %m%Graph
theta=0:0.1:Theta_max;theta1=0:0.1:Theta_max1;theta2=0:0.1:Theta_max2;x=r*sind(theta);x1=r1*sind(theta1);x2=r2*sind(theta2);y=r-r*cosd(theta);y1=r1-r1*cosd(theta1);y2=r2-r2*cosd(theta2);figure(3)plot(x,-y)title('movement of a particle through a magnetic field')xlabel('x(m)')ylabel('y(m)')hold onplot(x1,-y1)hold on plot(x2,-y2)hold off
Best Answer