Question: MATLAB code right now for part3.1 which Im happy with: RandStream.setGlobalStream(RandStream('mt19937ar','seed',1540267)); S=rand(1); alpha = 60*(1+(0.2*S)); V0 = 26*(1+(0.2*S)); z0(1)=V0*cosd(alpha); z0(2)=V0*sind(alpha); z0(3)=0; z0(4)=0; [t,z]=ode45(@Q3,[0, 5],z0'); Vx=z(:,1);

MATLAB code right now for part3.1 which Im happy with:
RandStream.setGlobalStream(RandStream('mt19937ar','seed',1540267));
S=rand(1);
alpha = 60*(1+(0.2*S));
V0 = 26*(1+(0.2*S));
z0(1)=V0*cosd(alpha);
z0(2)=V0*sind(alpha);
z0(3)=0;
z0(4)=0;
[t,z]=ode45(@Q3,[0, 5],z0');
Vx=z(:,1);
Vy=z(:,2);
x=z(:,3);
y=z(:,4);
figure('Name','Graphs of time history for Vx, Vy, x and y')
subplot(2,2,1); plot(t,Vx);
title('Horizontal velocity against time')
xlabel('Time (seconds)'); ylabel('Vx (m/s)');
subplot(2,2,2); plot(t,Vy);
title('Vertical velocity against time')
xlabel('Time (seconds)'); ylabel('Vy (m/s)');
subplot(2,2,3); plot(t, x);
title('Horizontal displacement against time')
xlabel('Time (seconds)'); ylabel('x (metres)');
subplot(2,2,4); plot(t, y);
title('Vertical displacement against time')
xlabel('Time (seconds)'); ylabel('y (metres)');
However when for question p3.2 I type into matlab:
Pindex=find(y
I receive an error message: index exceeds matrix dimensions... HELP :(  MATLAB code right now for part3.1 which Im happy with: RandStream.setGlobalStream(RandStream('mt19937ar','seed',1540267));
forcesmy, .y ng The air is assumed to have friction which is proportional to the velocity. The horizontal and vertical velocities and positions can be determined by solving the following differential equations (derived from the Newton's law) dt y(0)=v, cos (?) r(0)=v, sin (a) x(0) = 0 y(0)0 dx dt dy with m=10, B-2, g=981, ?-600+0.25 v,=260 + 0.25) where S is the student related parameter gencrated in the same way as for P1 3.1 Use a differential equation solver in MATLAB (i.c. ode45, ode23 or ode15s) to solve the above equations to find the solution for Vs, Vy, x, y and the corresponding time history t for the time pcriod of [0, 5] seconds. Plot all four graphs (v versus t, vy versus t, x versus t, and y versus t) in one figure window Find the time (t) when the ball strikes the ground, i.e. y-0The way to find the time tris to solve the system differential equations for a longer period time (done in P3.1) and then use interpl to find t, when y(t)-0 3.2 forcesmy, .y ng The air is assumed to have friction which is proportional to the velocity. The horizontal and vertical velocities and positions can be determined by solving the following differential equations (derived from the Newton's law) dt y(0)=v, cos (?) r(0)=v, sin (a) x(0) = 0 y(0)0 dx dt dy with m=10, B-2, g=981, ?-600+0.25 v,=260 + 0.25) where S is the student related parameter gencrated in the same way as for P1 3.1 Use a differential equation solver in MATLAB (i.c. ode45, ode23 or ode15s) to solve the above equations to find the solution for Vs, Vy, x, y and the corresponding time history t for the time pcriod of [0, 5] seconds. Plot all four graphs (v versus t, vy versus t, x versus t, and y versus t) in one figure window Find the time (t) when the ball strikes the ground, i.e. y-0The way to find the time tris to solve the system differential equations for a longer period time (done in P3.1) and then use interpl to find t, when y(t)-0 3.2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!