xuebaunion@vip.163.com

3551 Trousdale Rkwy, University Park, Los Angeles, CA

留学生论文指导和课程辅导

无忧GPA：https://www.essaygpa.com

工作时间：全年无休-早上8点到凌晨3点

微信客服：xiaoxionga100

微信客服：ITCS521

MATLAB代写-MATH 2009

时间：2021-04-12

MATH 2009 Engineering Modelling

Matlab M-file Proj1 multiple snippet.m

The snippet of Matlab code below shows an example of how to modify the skeleton code for Project 1

(given in the M-file blanks shear force.m) to deal with both (a) multiple vehicle axles and (b) ve-

hicles whose position functions are given by different formulas at different times.

Use the code to replace the appropriate part of the skeleton code in blanks shear force.m. You

will need to adapt the code below to match the details of Project 1 (numbers of vehicles and axles,

position functions, loads, length of bridge, etc).

% Snippet of code to allow multiple axles as well as piecewise-defined

% position functions.

% The bridge in this example is 400m long and the time duration

% of the simulation is 30 seconds. The time step used is 0.1

% seconds and the spatial step is 0.5 metres. We take 0 to be at

% the left end of the bridge, and the positive direction to be

% towards the right. Vehicle 1 is a three-axle truck moving from

% left to right, travelling at constant speed 15m/s for 10

% seconds, then accelerating at 3m/s^2 until the end of the

% simulation. Vehicle 2 is a two-axle car moving from right to

% left, travelling at constant speed 10m/s for 20 seconds, then

% accelerating at 4m/s^2 until the end of the simulation.

...

% Specify given data

L = 400;

initial position = [20 15 5 300 305];

load = [20000 30000 30000 10000 15000];

space step = 0.5;

time step = 0.1;

y = [0:space step:L];

t = [0:time step:30];

[Y,T] = meshgrid(y,t);

% Set up submatrices T1, T2, T3 of the time matrix T, to correspond

% to the three time periods: while vehicle 1 travels at constant speed,

% while vehicle 1 accelerates and vehicle 2 is at constant speed, and

% while both vehicles accelerate.

T1 = T(1:101,:);

T2 = T(102:201,:);

T3 = T(202:301,:);

% Create and initialize the four sums that appear in the equilibrium

% equations for the unknowns. (The four unknowns are reaction forces

% R2 and R3 at the left and right ends of the bridge, shear force V, and

% bending moment M.)

% The arrays for the four sums are matrices the same size as Y and T.

% Initialize them so that all entries are zero.

1

sum1 = zeros(size(Y)); % sum of weights on bridge

sum2 = zeros(size(Y)); % sum of moments due to weights on bridge

sum3 = zeros(size(Y)); % sum of weights to left of current y on bridge

sum4 = zeros(size(Y)); % sum of moments to left of current y on bridge

% Iteration via for-loops to calculate and sum up the contributions of

% each of the five axles to each of the four sums.

% Vehicle 1

% Constant velocity 15m/s for first 10 seconds,

% then accelerates at 3m/s^2

for i = 1:3, % loop over axles 1, 2, 3

X(1:101,:) = initial position(i) + 15*T1;

X(102:201,:) = initial position(i) + 150 + 15*(T2 - 10) + ...

0.5*3*(T2 - 10).^2;

X(202:301,:) = initial position(i) + 150 + 15*(T3 - 10) + ...

0.5*3*(T3 - 10).^2;

onoff = (sign(X) - sign(X - L))/2; % filter: axle on or off bridge

sum1 = sum1 + load(i).*onoff;

% count the load only if axle is on bridge

sum2 = ...

leftonly = (sign(X) - sign(X - Y))/2;

% filter: axle on or off bridge and to left of y

sum3 = ...

sum4 = ...

end

% Vehicle 2

% Constant velocity -10m/s for first 20 seconds,

% then accelerates at -4m/s^2

for i = 4:5,

X(1:101,:) = initial position(i) - 10*T1;

X(102:201,:) = initial position(i) - 10*T2;

X(202:301,:) = initial position(i) - 200 - 10*(T3 - 20) + ...

0.5*(-4)*(T3 - 20).^2;

onoff = (sign(X) - sign(X - L))/2; % filter: axle on or off bridge

sum1 = sum1 + load(i).*onoff;

% count the load only if axle is on bridge

sum2 = ...

leftonly = (sign(X) - sign(X - Y))/2;

% filter: axle on or off bridge and to left of y

sum3 = ...

sum4 = ...

end

% Solve the equilibrium equations to find R2, R3, V, M

R3 = sum2/L;

R2 = ...

V = ...

M = ...

...

2

学霸联盟

Matlab M-file Proj1 multiple snippet.m

The snippet of Matlab code below shows an example of how to modify the skeleton code for Project 1

(given in the M-file blanks shear force.m) to deal with both (a) multiple vehicle axles and (b) ve-

hicles whose position functions are given by different formulas at different times.

Use the code to replace the appropriate part of the skeleton code in blanks shear force.m. You

will need to adapt the code below to match the details of Project 1 (numbers of vehicles and axles,

position functions, loads, length of bridge, etc).

% Snippet of code to allow multiple axles as well as piecewise-defined

% position functions.

% The bridge in this example is 400m long and the time duration

% of the simulation is 30 seconds. The time step used is 0.1

% seconds and the spatial step is 0.5 metres. We take 0 to be at

% the left end of the bridge, and the positive direction to be

% towards the right. Vehicle 1 is a three-axle truck moving from

% left to right, travelling at constant speed 15m/s for 10

% seconds, then accelerating at 3m/s^2 until the end of the

% simulation. Vehicle 2 is a two-axle car moving from right to

% left, travelling at constant speed 10m/s for 20 seconds, then

% accelerating at 4m/s^2 until the end of the simulation.

...

% Specify given data

L = 400;

initial position = [20 15 5 300 305];

load = [20000 30000 30000 10000 15000];

space step = 0.5;

time step = 0.1;

y = [0:space step:L];

t = [0:time step:30];

[Y,T] = meshgrid(y,t);

% Set up submatrices T1, T2, T3 of the time matrix T, to correspond

% to the three time periods: while vehicle 1 travels at constant speed,

% while vehicle 1 accelerates and vehicle 2 is at constant speed, and

% while both vehicles accelerate.

T1 = T(1:101,:);

T2 = T(102:201,:);

T3 = T(202:301,:);

% Create and initialize the four sums that appear in the equilibrium

% equations for the unknowns. (The four unknowns are reaction forces

% R2 and R3 at the left and right ends of the bridge, shear force V, and

% bending moment M.)

% The arrays for the four sums are matrices the same size as Y and T.

% Initialize them so that all entries are zero.

1

sum1 = zeros(size(Y)); % sum of weights on bridge

sum2 = zeros(size(Y)); % sum of moments due to weights on bridge

sum3 = zeros(size(Y)); % sum of weights to left of current y on bridge

sum4 = zeros(size(Y)); % sum of moments to left of current y on bridge

% Iteration via for-loops to calculate and sum up the contributions of

% each of the five axles to each of the four sums.

% Vehicle 1

% Constant velocity 15m/s for first 10 seconds,

% then accelerates at 3m/s^2

for i = 1:3, % loop over axles 1, 2, 3

X(1:101,:) = initial position(i) + 15*T1;

X(102:201,:) = initial position(i) + 150 + 15*(T2 - 10) + ...

0.5*3*(T2 - 10).^2;

X(202:301,:) = initial position(i) + 150 + 15*(T3 - 10) + ...

0.5*3*(T3 - 10).^2;

onoff = (sign(X) - sign(X - L))/2; % filter: axle on or off bridge

sum1 = sum1 + load(i).*onoff;

% count the load only if axle is on bridge

sum2 = ...

leftonly = (sign(X) - sign(X - Y))/2;

% filter: axle on or off bridge and to left of y

sum3 = ...

sum4 = ...

end

% Vehicle 2

% Constant velocity -10m/s for first 20 seconds,

% then accelerates at -4m/s^2

for i = 4:5,

X(1:101,:) = initial position(i) - 10*T1;

X(102:201,:) = initial position(i) - 10*T2;

X(202:301,:) = initial position(i) - 200 - 10*(T3 - 20) + ...

0.5*(-4)*(T3 - 20).^2;

onoff = (sign(X) - sign(X - L))/2; % filter: axle on or off bridge

sum1 = sum1 + load(i).*onoff;

% count the load only if axle is on bridge

sum2 = ...

leftonly = (sign(X) - sign(X - Y))/2;

% filter: axle on or off bridge and to left of y

sum3 = ...

sum4 = ...

end

% Solve the equilibrium equations to find R2, R3, V, M

R3 = sum2/L;

R2 = ...

V = ...

M = ...

...

2

学霸联盟