Code:
promptSandR.m file
function [s,R] = promptSandR()
%asking the user to enter the s and R values
s = input('Enter speed of car(s): ');
R = input('Enter braking effeciency of car(R):');
end
calcbd.m file
function brakDist = calcbd(s, R)
g = 9.81;%gravitation due to gravity
brakDist = (s.^2)/(2*R*g);%formula to calculate breaking
distance
end
printbd.m file
function [] = printbd(brakDist)
%printing the breaking distance
disp('\nBreaking Distance is: ');
disp(brakDist);
end
test.m file
[s, R] = promptSandR;
brakDist = calcbd(s,R);
printbd(brakDist);
Output:
Enter speed of car(s): 65
Enter braking effeciency of car(R):0.8
Breaking Distance is:
269.1769
MATLAB s are applied 26. The braking distance of a car depends on its speed as...
Generate code with matlab please and thank you.
The braking distance of a car depends on its speed as the brakes
are applied and on the car’s braking efficiency. A formula for the
braking distance is
where bd is the braking distance, s is the car’s speed, R is the
braking efficiency and g is the acceleration due to gravity (9.81).
Write a a script that calls a function to prompt the user for s and
R, that function call...
Nay
programming languge is fine (MatLab, Octave, etc.)
This is the whole document this last picture i sent is the
first page
5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...