Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create the following MATLAB scripts. Compute the area A of a triangle with base

ID: 2079513 • Letter: C

Question

Create the following MATLAB scripts. Compute the area A of a triangle with base B and height H. Recall that the area of a triangle is half the base times its height. Compute the surface area SA and volume V for a cylinder with radius r and height h. SA=2 pi rh+2 pi r^2 V = pi rh Verify that sin^2:(x) + cos^2:(x) = 1 for x=l80 degree, 90 degree, 45 degree, and 30 degree. Use format long and assign the result to variable T. Use Ramanujan's approximation to calculate the value of pi and assign the result to variable P. 1/PI = 2 SQUAREROOT 2/9801 SIGMA _I = 0^INFINITY (4 K)! (1103 + 26390K)/(K!)^4 396^44 Verify by using the upper limit of k as 0.

Explanation / Answer

Matlab Code:

clc;
clear all;
%part a
B = 1.5;%m
H = 2.5;%m
area_of_traingle = 0.5*B*H;
disp('Area of triangle');
disp(area_of_traingle);
%part b
h= 2;%m
r = 4.5;%m
SA = (2*pi*r*h) + (2*pi*r^2);
V = pi*(r^2)*h;
disp('Surface area of cylinder');
disp(SA);
disp('Volume of cylinder');
disp(V);
%part c
format long;
x = [180, 90, 45, 30];
T = ((sind(x)).^2)+((cosd(x)).^2);
disp(T);
%part d
k=0;
piinv = ((2*sqrt(2))/(9801))*((factorial(4*k)*(1103+26390*k))/(((factorial(k)^4)*396^(4*k))));
pi = inv(piinv);
disp(pi);

output:

Area of triangle
1.875000000000000

Surface area of cylinder
1.837831702350029e+002

Volume of cylinder
1.272345024703866e+002

1 1 1 1

3.141592730013306

>>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote