Write the function sideOf which accepts one side of a right-angle triangle, a or b, and the hypotenuse c as input arguments and outputs the other side b or a.
1 view (last 30 days)
Show older comments
function side2Length = sideOf(side1Length, c)
side2Length = sqrt (c^2-side1Length^2);
:( its giving wrong answer
1 Comment
Answers (1)
ANKUR KUMAR
on 7 Jan 2018
sideOf(3,5)
function b=sideOf(a,c)
b=sqrt(c^2 - a^2);
end
Just one line function. Use the above script. It works if you are using MATLAB version 2016b or later, ortherwise create this function separately and write sideOf(3,5) in command window or in script.
0 Comments
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!