All the work should be done in MATLAB. Variables calculated in a function worksp
ID: 3168209 • Letter: A
Question
All the work should be done in MATLAB.
Variables calculated in a function workspace will not overwrite variables in the command window's workplace True False Create a function with the header A-myTriangle(b,h) where A is the arca of a triangle with base b and height h. Recall that the arca of a triangle is one half the base times the height. Solve your function for b-3 and h-5 then submit the area below Write a function with header [S,V]-myCylinder(rh) where r and h are the radius and height of a cylinder, respectively, and S and V are the surface area and volume of the same cylinder. Recall that the surface arca of a cylinder is 2r+2t rh, and the volume is trh. Solve you function and submit the surface area below for a radius of 1.5 and a height of 7.Explanation / Answer
1) FALSE
2)
function [A] = myTriangle(b,h)
A=b*h/2;
end
A=myTriangle(3,5)
3)
function [S,V]= myCylinder(r,h)
S=2*pi*r^2+2*pi*r*h;
V=pi*r^2*h;
end
[S,V]=myCylinder(1.5,7)