2. On HW2 # 1, we rescaled in the projectile problem using y-x/V2g-1 and = t/Vg-
ID: 2260549 • Letter: 2
Question
2. On HW2 # 1, we rescaled in the projectile problem using y-x/V2g-1 and = t/Vg-1 This yielded the IVP du 1)2 where = V2/gf. Also, we used the same rescaling in the constant-gravity version of the problem to get =-1. y(0) = 0, y(0) = 1 dr2 7 You do NOT need to rederive these here Make copies of the files projectile m and 'proj rhs.m and name the coples, say, ‘projec- tile2.m, and .proJ-rhs2a.rn", Edit these files to solve (3). Next, edit the files solne more so that 'projectile2.m solves both (3) and (4) (You will need to add another ode45 command to 'projectile2.m' and you wll need to create another file like 'proj.rhs2a.m, which you can call, say, proj.rhs2b.m', for equation (4)) Let denote the solution to (3) and let y2 de- note the solution to (4). Edit the plotting commands in ‘project ile2.m, so that you can plot yh and y2 on the same pair of axes. (Download the file 'plot examples., which shows an example of plotting 2 functions on the same pair of axes.) Now produce 3 plots, for E = 1, = .1, and = .01. Explain why what you observe in these 3 plots makes sense physically. So what you need to hand in is just these 3 plots and your explanation.) Your explanation will be closely related to your explanation for HW2 #1(f)Explanation / Answer
global eps;
eps = 1;
init = [0,5];
[T,Y1] = ode45(@proj_rhs2a,t,init,options);
[T, Y2] = ode45(@proj_rhs2b,t,init,options);
subplot(2,1,1)
plot(T,Y1(:,1))
title(['y1",y2" versus tau, eps=',num2str(eps)])
hold on
plot(T,Y2(:,1))
hold off
% proj_rhs2a.m
function dy1 = proj_rhs2a(t,y1)
global eps;
dy1 = zeros(2,1);
dy1(1) = y1(2);
dy1(2) = -1/(eps*y1 +1)^2;
%proj_rhs2b.m
function dy2 = proj_rhs2b(t,y2)
global eps;
dy2 = zeros(2,1);
dy2(1) = y2(2);
dy2(2) = -1;
% The same exercise can be carried out for eps= 0.1 and 0.01
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.