In the MATLAB If you were to write a function to calculate t

In the MATLAB, If you were to write a function to calculate the drag coefficient of a vehicle (cd) using drag (d), density (rho), velocity(u) and with frontal area of the car (a) with the equation cd=d/(0.5*rho*u^2*a). Call the function dragcalc What would the first line of the function be? (space between the function and output argument bracket, square brackets around output argument, parentheses around input arguments but no spaces only commas to separate variables)

Solution

First line of the function :

function [cd] = dragcalc (d,rho,u,a)

Here cd : output argument i.e. drag coefficienct to be calculated by calling the function dragcalc.

d = darg , rho = density of the air, u = velocity of the car and a = frontal area of the car are input arguments.

The first line of the function will call dragcalc. It will take the value of d, rho, u and a from the main script file

or main function and then go to dragcalc function where it will calculate cd according to the equation given

in the question. Then this calculated cd will return to the script file or main function file.

In the MATLAB, If you were to write a function to calculate the drag coefficient of a vehicle (cd) using drag (d), density (rho), velocity(u) and with frontal a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site