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

Matlab Program Help! Please provide the code to the question in the picture belo

ID: 2080020 • Letter: M

Question

Matlab Program Help! Please provide the code to the question in the picture below. Thanks

Write a program that ask for a positive integer n, and finds and stores all the factors of n in the vector 'Fact' and computes their geometric average defined as Geo_Ave =^N Squareroot f_1 f_2 f_3 ...f_N =^N Squareroot f_1^N Squareroot f_2^4 Squareroot f_3...^N Squareroot f_N where f_1 f_2 f_3 ...f_N are the factors of n and N is the number of factors. You should use only one loop, n=input ('Enter a positive integer:');

Explanation / Answer

Ans)

Matlab Code

=========


n=input('Enter a positive integer:');
K=1:n;%all the integers from 1 to given number
%if the remainder is zero then it is a factor else condition fails
Fact = K(rem(n,K)==0);
Fact
N=length(Fact);%no of factors
Geo_Ave=(prod(Fact))^(1/N);
Geo_Ave

==========

Result when you run on command window

==

>> GeoAve
Enter a positive integer:15

Fact =

1 3 5 15


Geo_Ave =

3.8730

>>

==============