Think of this as an algebra problem first and a matlab problem second. The translation to Matlab syntax is straightforward once you set up the algebraic operations.
Algebraically:
s = vt, or t = s/v
s = 60 km, split into two 30-km segments.
Average velocity = total distance / total time
For boat 1: t1 = 30/60 + 30/60
For boat 2: t2 = 30/30 + 30/90
You can express this in Matlab with something like:
distance = 60;
d2 = distance/2;
v1a = 60;
v2a = 60;
...
t1 = d2/v1a + d2/v2a;
...
vavg1 = distance / t1;
Faith L.
ohh I see, thank you so much!08/28/21