Write a function car(v_0, a,t) in MATLAB. The function returns the velocity and distance of a car based on parameters v_0, a and t. The Math equations are:
v_t=v_0+a*t;
s=v_0*t+1/2a*t2;
code:
output :
raw_code :
function [v_t,s] = car(v_0,a,t)
%function to calculate velocity and distance
%based on given parameters
%given relations
v_t = v_0 + a*t;
s = v_0*t + (1/2)*a*(t^2);
endfunction
***do comment for queries and rate me up************
Get Answers For Free
Most questions answered within 1 hours.