1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dimulka [17.4K]
4 years ago
12

For this homework you are writing a main function, with 3 subfunctions. 2. The "main" function is to be named arm_prop a. Inputs

: x => this is the vector that is sent to the function b. Outputs: gm, ra, hm => these are the outputs of the function gm => geometric mean, ra => RMS average, hm => ha
Engineering
1 answer:
ra1l [238]4 years ago
3 0

Answer:

MATLAB CODE:

clc;

clear all;

x=[1 2 3 4]; %Input vector of variable size

[gm,ra,hm]=arm_prop(x) %Main function calling , output values are hm, ra, hm and imput is x

%% Main function

function [gm,ra,hm]=arm_prop(x)

[gm]=geo_mean(x); %Calling Sub function 1

[ra]=rms_avg(x); %Calling Sub function 2

[hm]=har_mean(x); %Calling Sub function 3

 

%Sub function 2 =Rms average

function [gm]=geo_mean(x)    

n=numel(x); %calculating number of elemnts in vector x

temp=1; %Temporary value for multiplying each and every value of x

for i=1:1:n % For loop run for number of elements in x

temp=temp*x(i); %Multliplyng each and every element of x

end

gm=temp^(1/n); % Calculating geometric mean

end

%Sub function 2 =Rms average

function [ra]=rms_avg(x)

temp=0; %Temporary value for adding square of each and every value of x

N=numel(x); %calculating number of elemnts in vector x

for i=1:1:N % For loop run for number of elements in x

temp=temp+x(i)^2; %Adding square of each and every element of x

end

ra=(temp/N)^(1/2); % Calculating Rms average

end

%Sub function 3 =Harmonic mean

function [hm]=har_mean(x)

temp=0; %Temporary value for adding reciprocal of each and every value of x

N=numel(x); %calculating number of elemnts in vector x

for i=1:1:N % For loop run for number of elements in x

temp=temp+(1/x(i)); %Adding sreciprocal of each and every element of x

end

hm=N/temp; % Halculating Harmonic mean

end

end

Results:

gm =

2.2134

ra =

2.7386

hm =

1.9200

Here in one main function. 3 sub functions are written. Every sub function returns one output. As all 3 sub functions are inside main function, main function returns 3 output values gm, ra, hm.

Explanation:

You might be interested in
Cleaning the shop's floor is being discussed. Technician A says to flush the waste and dust into a floor drain. Technician B say
lawyer [7]

Answer:

Technician B

Explanation:

A HEPA or high-efficiency particulate Type filter is capable of capturing 99 percent of particles that are 2 microns or larger, high-efficiency particulate airsuch as pet dander and DUST. So this is the best answer. I hope you find this helpful!

4 0
3 years ago
Tyuuyiopopiouyttrrtrffrlkl,k;;';'l.l
Viktor [21]

Answer:

Explanation:

do you have any other questions besides "tyuuyiopopiouyttrrtrffrlkl,k;;';'l.l"

5 0
3 years ago
The project's criteria.
Lena [83]

Answer: design 4

Explanation: I got it right

8 0
2 years ago
In some companies, workers who increase the quantity or quality of their work receive a. benefits. c. performance bonuses. b. pe
Greeley [361]

Answer:

performance bonuses

Explanation:

3 0
3 years ago
You have the assignment of designing color codes for different parts. Three colors are used on each part, but a combination of t
Masja [62]

Answer:

7 available

Explanation:

Since 3 colors are available r = 3

Total combination = 35

nCr = 35 ---1

nCr = n!/(n-r)!r!---2

We put equation 1 and 2 together

n-1)(n-2)(n-3)!/n-3)! = 35x 3!

We cancel out (n-3)!

(n-1)(n-2) = 210

7x6x5 = 210

nC3 = 35

7C3 = 35

So If there are 35 combinations, 7 colors are available.

Thank you!

3 0
3 years ago
Other questions:
  • Water at 20 °C is flowing with velocity of 0.5 m/s between two parallel flat plates placed 1 cm apart. Determine the distances f
    5·1 answer
  • 2. A Class B fire includes burning:
    8·1 answer
  • Water at 20 °C is flowing with velocity of 0.5 m/s between two parallel flat plates placed 1 cm apart. Determine the distances f
    5·1 answer
  • The force on a cutting tool are 2600N vertically downward and 2100 horizontal. Determine the resultant force acting on the tool
    12·1 answer
  • Why did my dad leave me yesterday like whatd i do?
    12·1 answer
  • A 1/4th scale car is to be tested in a wind tunnel. If the full scale speed of the car is 30m/s, what should be the wind tunnel
    9·1 answer
  • . A belt drive is desired to couple the motor with a mixer for processing corn syrup. The 25-hp electric motor is rated at 950 r
    13·1 answer
  • When Hailey participated in a tree plantation drive, she wore her most comfortable loungewear. However, the same attire was not
    11·1 answer
  • A customer got debited twice, how would you investigate and resolve this conflict on the customer side and on the company side?
    5·1 answer
  • Of the core elements of successful safety and health programs, Management Leadership, Worker Participation, and what else relate
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!