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
Schach [20]
3 years ago
15

Create a separate function file fieldtovar.m that receives a single structure as an input and assigns each of the field values t

o user-defined variables. The function should work for a structure with any number of fields. Additionally, implement an error check to ensure that the number of userdefined variables (output arguments) is equal to the number of structure fields.
Engineering
1 answer:
Soloha48 [4]3 years ago
4 0

Answer:

Explanation gives the answer

Explanation:

% Using MATLAB,

% Matlab file : fieldtovar.m

function varargout = fieldtovar(S)

% function that accepts single structure as input, assigning each

% of the field values to user-defined variables

fields = fieldnames(S); % get the field names of the input structure

% check if number of user-defined variables and number of fields in

% structure are equal

if nargout == length(fields)

% if equal assign each value of structure to user-defined varable

for i=1:nargout

varargout{i} = getfield(S,fields{i});

end

else

% if not equal display an error message

error('The number of output variables does not equal the number of fields');

end

end

%This brings an end to the program

You might be interested in
Marco is an Italian architect. He has recieved a contract
kirill [66]

Answer:

Marco is an Italian architect. He has received a contract to design a spacious building.

Explanation:

ect.

8 0
3 years ago
Applying the Entropy Balance: Closed Systems Five kg of carbon dioxide (CO2) gas undergoes a process in a well-insulated piston–
Mrrafil [7]

Answer:

a) the amount of energy produced in kJ/K is 0.73145 kJ/K

b) the amount of energy produced in kJ/K is 0.68975 kJ/K

The value for entropy production obtained using constant specific heats is approximately 6% higher than the value obtained when accounting explicitly for the variation in specific heats.

Explanation:

Draw the T-s diagram.

a)

C_p = 0.939 kJ/kg.K , m = 5 kg , T₂ = 520 K , T₁ = 280

R = [8.314 kJ / 44.01 kg.K] , P₂ = 20 bar , P₁ = 2 bar

Δs = m[c_p ln(\frac{T_2}{T_1}) - Rln(\frac{P_2}{P_1})]

Substitute all parameters in the equation

Δs = 5[(0.939) ln(\frac{520}{280}) - (\frac{8.314}{44.01})ln(\frac{20}{2})]

Δs = 5 kg × 0.14629 kJ/kg.K

    = 0.73145 kJ/K

b)

Δs = m[\frac{s^0(T_2) - s^0(T_1)}{M} - Rln(\frac{P_2}{P_1})]

Where T₁ = 280 K , s°(T₁) = 211.376 kJ/kmol.K

           T₂ = 520 K , s°(T₂) = 236.575 kJ/kmol.K

R = [8.314 kJ / 44.01 kg.K] , M = 44.01 kg.K , P₂ = 20 bar , P₁ = 2 bar

Δs = 5[\frac{236.575 - 211.376}{44.01} - (\frac{8.314}{44.01})ln(\frac{20}{2})]

    = 5 kg (0.13795 kJ/kg.K)

    = 0.68975 kJ/K

The value for entropy production obtained using constant specific heats is approximately 6% higher than the value obtained when accounting explicitly for the variation in specific heats.

7 0
4 years ago
pump delivers 11000 lb/hr of water from an elevation 30 ft below the pump to an elevation 50 ft above the pump through various d
mojhsa [17]

Answer:

good luck

Explanation:

4 0
3 years ago
Which type of hazard results in water pollution? A) Biological hazard B) Chemical hazard C) Physical hazard D) Environmental haz
Eduardwww [97]

Answer:

(a). biological pollution

7 0
3 years ago
Read 2 more answers
A low-altitude meteorological research balloon, temperature sensor, and radio transmitter together weigh 2.5 lb. When inflated w
gogolik [260]

Answer:

12 mins

Explanation:

The summation of the forces in vertical direction

= Fb - Fd - w = 0 ∴ Fd = Fb - w  ----- ( 1 )

Fb ( buoyant force ) = Pair * g * Vballoon ------- ( 2 )

Pair = air density , Vballoon = volume of balloon

Vballoon = \frac{\pi D^3}{6} ,  where D = 4  ∴  Vballoon = 33.51 ft^3

g = 32.2 ft/s^2

From property tables

Pair = 2.33 * 10^-3 slug/ft^3

μ ( dynamic viscosity ) = 3.8 * 10^-7 slug/ft.s

<em>Insert values into equation 2 </em>

Fb = ( 2.33 * 10^-3 ) * ( 32.2 ) *( 33.51 )  = 2.514 Ib

∴ Fd = 2.514 - 2.5 = 0.014 Ib ( equation 1 )

Assuming that flow is Laminar  and  RE < 1

Re = (Pair * vd) / μair   -------- ( 3 )

where:  Pair = 2.33 * 10^-3 slug/ft^3 ,  vd = ( 987 * 4 ) ft^2/s ,   μair = 3.8 * 10^-7 slug/ft.s

Insert values into equation 3

Re = 2.4 * 10^7 (  this means that the assumption above is wrong )

Hence we will use drag force law

Assume Cd = 0.5

Express  Fd using the relation below

Fd = 1/2* Cd * Pair * AV^2

therefore V = 1.39 ft/s

Recalculate  Reynold's number using  v = 1.39 ft/s

Re = 34091

from the figure Cd ≈ 0.5 at Re = 34091  

<u>Finally calculate the rise time ( time taken to reach an altitude of 1000 ft ) </u>

t = h/v

  = 1000 / 1.39 = 719 seconds ≈ 12 mins

3 0
3 years ago
Other questions:
  • What is tcp in network?
    13·1 answer
  • A column in a building is subjected to the following load effects:
    13·1 answer
  • Disadvantages of bezier curve and b-spline
    5·1 answer
  • Calculate the line parameters ????′, ????′, ????′, and ????′ for a coaxial line with an inner conductor diameter of 0.5 cm and a
    13·1 answer
  • What is a perpetual motion machine of the second kind?
    11·1 answer
  • Witch part of the testing and evaluation stage of designing a PDA
    9·1 answer
  • What are atomic bombs made out of <br> Just wondering
    10·1 answer
  • The mechanical properties of a metal may be improved by incorporating fine particles of its oxide. Given that the moduli of elas
    9·1 answer
  • Question #4
    9·1 answer
  • The ratio of boys to girls in the class was 2 to 3. If there were 18 girls in the class, how many students were in the class
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!