Answer:
//Set a piecewise function v(t).
function v = vpiece(t)
//Set the condition first for t.
if ((0<=t)and(t<=8)) //Set if condition
// first equation of velocity.
v = 10*t^2 - 5*t;
//Set the condition second for t.
elseif((8<=t)and(t<=16)) //Set elseif condition
//second equation of velocity.
v = 624 - 5*t;
//set the condition third for t.
elseif((16<=t)and (t<=26)) //Set elseif condition
//third equation of velocity.
v = 36*t + 12*(t - 16)^2;
//Set the fourth condition for t.
elseif t>26
//fourth equation of velocity.
v = 2136*exp(-0.1*(t-26));
//Last condition.
else
//fifth equation of velocity.
v = 0;
//End of the function v.
end
//set a variable and initialize it to 0.
a=0;
//Starting the loop.
for j = -5: 0.5 : 70
//Increment the value of a by 1.
a = a + 1;
t(a) = j;
v(a) = vpiece(t(a));
//End of for loop.
end
//Plot the graph between t and v.
plot(t,v)
//Write the label for the x-axis.
xlabel('t')
//Write the label for the y-axis.
ylabel('velocity')
//Write the title of the plot.
title('Plot of velocity vs t')
Explanation:
Firstly, we set the piecewise method.
Then we set the first condition, after that we apply the condition of velocity.
Then we set the second condition, after that we apply the condition of velocity.
Then we set the third condition, after that we apply the condition of velocity.
Then we set the fourth condition, after that we apply the condition of velocity.
Then we set the last or fifth condition, after that we apply the condition of velocity.
Then we set the variable "a" to 0.
Then start the loop and increase the value by 1.
And after all, we write the title of the plot.