one script two anonymous functions
Show older comments


I do not undestand when I wrong in my code
thank you so much for yor help
ThirdSide = @(a,b,C) sqrt(a^2+b^2-(2*a*b*cos(C)));
TriangleArea = @(a,b,C) ((a*b)/2)*sin(C);
SideC =ThirdSide(5,8,50*pi/180)
AreaABC=TriangleArea(5,8,50*pi/180)
Answers (2)
Steven Lord
on 13 Oct 2020
1 vote
Based on the problem description I'm guessing C is an angle in degrees, not radians. If that's the case take a look at the sind function.
Fanele
on 6 Nov 2022
Moved: Image Analyst
on 6 Nov 2022
ThirdSide=@(a,b,C) sqrt(a^2+b^2-2*a*b*cos(C*pi/180))
TriangleArea=@(a,b,C) (((a*b)/2)*sin(C*pi/180))
SideC=ThirdSide(5,8,50)
AreaABC=TriangleArea(5,8,50)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!