By using the points available in the following matrix,write a code in matlab tha
ID: 3583447 • Letter: B
Question
By using the points available in the following matrix,write a code in matlab that finds the maximum area of triangle
X y
A = [ 659, 798
507, 245
460, 14
269, 628
158, 312
533, 601
170, 590
396, 639
531, 315
793, 286
497, 332
367, 720
622, 70
440, 503
702, 80
57, 455
193, 709
898, 725
560, 259
238, 546
555, 980
962, 360
240, 835
547, 957
378, 363
845, 282
740, 756
559, 486 ]
Explanation / Answer
octave:2> A = [ 659 798;
507 245;
460 14;
269 628;
158 312;
533 601;
170 590;
396 639;
531 315;
793 286;
497 332;
367 720;
622 70;
440 503;
702 80;
57 455;
193 709;
898 725;
560 259;
238 546;
555 980;
962 360;
240 835;
547 957;
378 363;
845 282;
740 756;
559 486 ]
A =
659 798
507 245
460 14
269 628
158 312
533 601
170 590
396 639
531 315
793 286
497 332
367 720
622 70
440 503
702 80
57 455
193 709
898 725
560 259
238 546
555 980
962 360
240 835
547 957
378 363
845 282
740 756
559 486
octave:3> c=zeros(28,1)
c =
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
octave:4> for i=1:29
> > c(i)=(A(i,1)*A(i,2))/2
> > end
c =
2.6294e+05
1.2852e+05
1.1661e+05
6.8192e+04
4.0053e+04
1.3512e+05
4.3095e+04
1.0039e+05
1.3461e+05
2.0103e+05
1.2599e+05
9.3034e+04
1.5768e+05
1.1154e+05
1.7796e+05
1.4450e+04
4.8926e+04
2.2764e+05
1.4196e+05
6.0333e+04
1.4069e+05
2.4387e+05
6.0840e+04
1.3866e+05
9.5823e+04
2.1421e+05
1.8759e+05
1.4171e+05
2.0229e+05
octave:5> [val idx]=max(c)
val = 325525
idx = 18
octave:6> disp(['The maximum area of triangle is ' num2str(val) ' of vertices ' num2str(A(18,:)) '.']);
The maximum area of triangle is 325525 of vertices 898 725.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.