Question 4
SOURCE CODE IN MATLAB:
areaVolume.m
function [A, V]=areaVolume(R, d)
%calculating area A and volume V
A=pi*pi*d*(2*R+d);
V=0.25*pi*pi*d*d*(2*R+d);
end
areaVolumeGraph.m
D=0.5 : 0.1 : 3; %setting diameter d from 0.5 to 3
A=[];
V=[];
k=1;
%finding area and volume
for d=D
R=d+15;
[A(k), V(k)]=areaVolume(R, d);
k+=1;
end
%plotting results
plot(D, A, D, V), title("Area and Volume vs Diameter"),
legend("Area", "Volume"), xlabel("d --->"), ylabel("Area/Volume
--->");
OUTPUT:
Question 3
SOURCE CODE IN MATLAB:
%1
A=[13 -10 15; 19 14 -11; -17 18 24; 12 -31 16]
B=[-10 8 11; 14 11 -8; 13 -14 18; 9 23 -12]
%2
sum1=sum(A(:, 2))
%3
prod1=prod(B(3, :))
%4
colProd=A(:, 1).*B(:, 2)
%5
colProdSum=sum(A(2, :).*B(4, :))
%6
colProdMax=max(A(:, 2).*B(:, 1))
OUTPUT:
Regards!
write it in matlab language Question No 4 6 Marks The surface area and volume of...
2. Matrix A = Matrix B = log(A) Write MATLAB expressions to do the following. Evaluate the sum of the first row of B Evaluate the maximum value in the vector resulting from element-by-element multiplication of the first column of B with the third column of A. Use element-by-element division to divide the third row of A by the first three elements of the second column of B and evaluate the sum of the elements of the resulting vector.
How is Problem 1 (a through e) typed up in Matlab? I would like to know how the commands is typed up along with solution please. Assignment 6 Problem 1) Consider the two following matrix, 1 4 2 2 4 100 and B In(A) 7 9 7 3 42 a) Select just the second row of B. b) Evaluate the sum of the second row of B. c) Multiply the second column of B and the first column of A...
using matlab Create the following matrix B. [18 17 16 15 14 13] 12 11 10 9 8 7 6 5 4 3 2 1 Use the matrix B to: (a) Create a six-element column vector named va that contains the elements of the second and fifth columns of B. (6) Create a seven-element column vector named vb that contains elements 3 through 6 of the third row of B and the elements of the second column of B. Create...
Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices and vectors in MATLAB [ 2 -6 3 ] [ 5 ] -3 A= 2 -7 -2 , B= 2 -2 -3 , b= -13 , c= 3 -1 4], d= 0 [ 7 -2 7 [1 -8 -1 ] [ 10 (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). - 3 (b) Construct a 6 x...
To estimate the surface area and volume of a wine barrel, the diameter of the barrel is measured at different points along the barrel. The surface area, S, and volume, V, can be determined by: S = 2π∫0Lrdz and V = π∫0Lr2dzUse the data given in the table to determine the volume and surface area of the barrelz (in.)-18-12-6061218d (in.)02.63.24.85.666.2(a) Use the composite trapezoidal method. (b) Use the composite Simpson's 1/3 method. (c) Use the composite Simpson's 3/8 method.
Using Matlab Write a program which will: a. Accept two numbers from the user m and n b. Define an array with the dimensions a(n,m) and fill it with random numbers in the range of -100 to 100 inclusive. c. Provide the user the following menu from which he can select: 1. Sum of all elements in the array. Print the result. 2. Sum of the element in a row that he’ll specify. Print the result. 3. Sum of the...
6. Write a function integerdivision that takes two input numbers and divides the first one with the second one. Question 2 a) Create a vector A with all integers between 5 and 400. 4 Marks ) Given a matrix Z, how to access element of the matrix. c) What is the output of this MATLAB code? A [2,4,10,13;16,3,7,18, 8,4,9,25:3,12,15,17); length(A) size(A) Ans) Ans) 6. Write a function integerdivision that takes two input numbers and divides the first one with the...
Need help with this MATLAB question 4.4 (25 points) Write and test the code for the function mysteryFunction that takes a vector, V, generate a new vector W, in which each element is the sum of the corresponding element in V and the previous element of V, and return two values (mysteryMean, mysteryStdev] of W. Consider the previous element of V(1) to be 0. For example, [mysteryMean, mysteryStdev] = mysteryFunction(1:8), W= [1 3 5 7 9 11 13 15] mysteryFunction...
cope the code please thanks Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate a matrix "A" as follow. A= 16 6 8 2 10 18 12 14 4 I. II. Divide the matrix A by 2 and store the result in a matrix B. Combine matrices A & B to obtain the following matrix C. Also...
matlab progam A commonly used matrix operation in linea alpebrais matrix matrix multiplication. Write a script that reads a matrix M from the that this is different from the clement wise Squaring of the matrix ( M 2). To do this, follow these steps income che of them (M2) Note a. Read a 2x2 matrix from the user and store it in M. Make sure you let the user know what to input b. Print the dimensions of the matrix,...