Hey, physics side of tumblr, can you help me with some homework? I can't get this to work
A particle with mass M has a speed V going up. A force acts on the particle with force F, perpendicular to the direction of its movement at all times (like a magnetic force \ an object tied to a rope). No gravity is applied
Hello physicsblr people of Tumblr! I'm having an issue with a MATLAB app file, and was wondering if anyone knew what the deal with it might be. Code + more info under the cut! Any help/commiseration/reblogs MUCH appreciated :)
Essentially, I'm looking to model a free particle wave packet dispersing over time. In the base code, it works just fine! See:
However, once I switch it into the app editor, attach the wavelength value to a slider, and change all the plot functions to be on the UIAxes, it will only plot the initial state. See:
If anyone knows why the code (below, "problem areas" highlighted in red) won't evolve over time in the app like it does in the code editor, PLEASE help!
APP CODE:
% Parameters, Constants and Other Such Sundry Items
Nx = 501; % Number of x points [1001]
Nt = 4000; % Number of time steps (not seconds)
L = 5e-9; % Width of X domain [5e-9]
me = 9.11e-31; % electron mass
hbar = 1.06e-34; % Planck's constant
e = 1.602e-19; % elementary charge
x = linspace(0,L,Nx);
dx = x(2) - x(1);
C1 = 1/10; % Various Constants and things to make life easier
dt = C1 * 2 * me * dx^2 / hbar;
C2 = e*dt/hbar;
% Functions, etc.
psiR = zeros(Nt,Nx); % wave function—real part
psiI = zeros(Nt,Nx); % wave function—imaginary part
U = zeros(1,Nx); % potential energy
% Starting packet position
nx1 = round(Nx/6);
s = L/25; % wave pulse width
wL = app.WavelengthSlider.Value; % this is the only modification to this part of the code. In the original code, it's set to 1.6e-10.
yR = exp(-0.5.*((x-x(nx1))./s).^2).*cos((2*pi).*(x-x(nx1))./wL);
yI = exp(-0.5.*((x-x(nx1))./s).^2).*sin((2*pi).*(x-x(nx1))./wL);
psiR(1,:) = yR;
psiI(1,:) = yI;
% Solve Schrödinger Equation
for nt = 1 : Nt-1
for nx = 2 : Nx - 1
yR(nx) = yR(nx) - C1*(yI(nx+1)-2*yI(nx)+yI(nx-1)) + C2*U(nx)*yI(nx);
end
psiR(nt+1,:) = yR;
for nx = 2 : Nx-1
yI(nx) = yI(nx) + C1*(yR(nx+1)-2*yR(nx)+yR(nx-1)) - C2*U(nx)*yR(nx);
end
psiI(nt+1,:) = yI;
end
for nt = 2:Nt
psiI(nt,:) = 0.5*(psiI(nt,:) + psiI(nt-1,:));
end
% Plotting (This is where the troubles begin; app axes callbacks correspond to the above labelled axes)
for time = 1: 100: Nt
xP = x.*1e9;
yP = psiR(time,:);
plot(app.PsiRAxes,xP,yP,'Color','#54b0b6','linewidth',2)
hold on
yP = psiR(1,:);
plot(app.PsiRAxes,xP,yP,'Color','#54b0b6','linewidth',1)
hold off
grid on
box on
xP = x.*1e9;
yP = psiI(time,:);
plot(app.PsiIAxes,xP,yP,'Color','#E1C699','linewidth',2)
hold on
yP = psiI(1,:);
plot(app.PsiIAxes,xP,yP,'Color','#E1C699','linewidth',1)
hold off
grid on
box on
xP = x.*1e9;
yP = psiR(time,:).^2 + psiI(time,:).^2;
plot(app.ProbAxes,xP,yP,'k','linewidth',2)
hold on
yP = psiR(1,:).^2 +psiI(1,:).^2;
plot(app.ProbAxes,xP,yP,'k','linewidth',1)
hold off
grid on
box on
hold off
pause(0.1)
end
THANK YOU SO MUCH IF YOU READ THIS FAR! Complimentary picture of my cat:
im in my last year of school and im planning to take up phy in college too! do you have any thing for me that i should keep in mind while studying for exams+first year experiences?
First year of college is an adjusting period. You’re not used to things happening the way they happen in college, classes and exams and what not. So, most importantly don’t be too hard on yourself in your first year. By the end of the first semester you’ll sort of have an idea on how to go about things and by the end of the year you’ll know how to handle things. It might be overwhelming and scary and stressful, but you’re not alone everyone goes through that.
Just show up for classes, it can be really hard to be disciplined enough to go for every class because you can miss your class and no one will give a fuck, but it WILL affect your understanding, of course it’s not possible to never skip so when you do make sure you go through the slides or the reading material or some one else’s notes from that class before you attend the next one. Make sure you do your assignments on your own and ask your doubts, if you don’t wanna ask in class or even office hours, ask a friend. But slowly you’ll have to have good relations with your professors if you want to get into research and carry on with physics. By the end of your degree you should have at least two professors who can write you a good LOR. Do your research on your professors, ask to work on a project under them, if they don’t have one going on which involves students, come up with your project idea or talk to the Head of the Department. You should have at least one project that you’ve done in your bachelors because there’s a lot of competition out there. And this will give you and edge.
As for exams, if you mean university exams, it depends on your prof. If they give more theoretical question papers or problem sets or a mix of both. But in general; physics is a subject where you can follow multiple approaches and get the same answer. So you have to specify what you’re doing. For eg for a particular question you can resolve forces and solve for velocity or you can use conservation of energy, it’s almost always entirely upto you, so you have to specify “acc to WE theorem...” because the prof doesn’t know what’s going on in your head so make sure you tell them what is going on, it might seem obvious to you but you’ll always benefit from writing whatever you’re thinking. Like “taking reduced mass because the masses are comparable and then taking center of mass” to solve a problem, that may seem obvious but doesn’t hurt to mention.
One tip to understand the subject better, just understand what the laws and the equations mean. You need to know what the formula is telling you and what it’s not. Try to find or make your own graphical representation of a formula, it is helpful in visualising what is actually happening. Oh and whenever you get stuck, try to derive your own formula based on your existing knowledge and keep it the last resort to find the solution from a book or whatever. That will help you improve your mathematical intuition and make you better at the subject because if you were wrong, you’ll know why you can’t use that concept there which is extremely helpful.
Best of luck anon!! I hope you enjoy university and physics and that it’s good to you!!!
PS. I’m strictly speaking from a private Indian university’s POV, idk how the projects and stuff work in govt. unis but really don’t know how the other countries’ education system is.
I’ve decided to relearn physics cuz I fucking love physics and I’m taking some really good notes so if you’re in physics and you’d like some help or just some notes, feel free to message me!
Already given an answer here, so why not! I can help with high school science (biology, chemistry, math and physics), chemistry up to college level, calc until the 2 (multiple derivatives), and biochemistry. If standard science is not your thing, I'm Brazilian, so I can cover portuguese and give some perspective on our history for those essays on foreign matters~
I’m scrolling through you blog and at this point I don’t even know if I’m laughing or crying cause physics is so much pain but also I like it help dm pls
Hello! I’m not sure how much help we’ll be; after all, our own physics class ended last spring. We can try to help to the best of our abilities this weekend and if we fail, we can redirect you to good practice problems and helpful websites so you don’t have to wade through all the internet sludge.
This goes for anyone who needs assistance with high school physics. I don’t pretend to be qualified above an AP Mechanics level.