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
An ocean thermal energy conversion system is being proposed for electric power generation. Such a system is based on the standar
Dennis_Churaev [7]

Answer:

a) the heat exchanger area required for the evaporator is 11178.236 m²

b) the required flow rate is 1993630.38 kg/s

Explanation:

Given the data in the question;

Water temperature near the surface = 300 K

temperature at reasonable depths ( cold ) = 280 K

power plant output W' = 2 MW

efficiency η = 3% = 0.03

we know that; efficiency η = W'_{power-out / Q_{supplied

we substitute

0.03 = 2 / Q_{supplied

Q_{supplied = 2 / 0.03

Q_{supplied = 66.667 MW = 66.667 × 10⁶ Watt

Th_{in = 300 K       Th_{out = 292 K

Tc_{in = 290 K       Tc_{out = 290 K    

Now, Heat transfer in evaporator;

Q = UA( LMTD )

so

LMTD = (ΔT₁ - ΔT₂) / ln( ΔT₁ / ΔT₂ )

first we get ΔT₁ and ΔT₂

ΔT₁ = Th_{in - Tc_{out  = 300 - 290 = 10 K

ΔT₂ = Th_{out - Tc_{in  = 292 - 290 = 2 K

so we substitute into our equation;

LMTD = (10 - 2) / ln( 10 / 2 )

LMTD = 8 / ln( 5 )

LMTD = 8 / 1.6094379

LMTD = 4.97

a) Heat transfer Area will be;

Q_H = UA( LMTD )

we substitute

66.667 × 10⁶ = 1200 × A × 4.97

66.667 × 10⁶  = 5964 × A

A = (66.667 × 10⁶) / 5964

A = 11178.236 m²

Therefore, the heat exchanger area required for the evaporator is 11178.236 m²

b) Flow rate  

we know that;

Q_H = m'C_P( T_{in - T_{out )  

specific heat capacity of water Cp = 4.18 (kJ/kg∙°C)

we substitute

66.667 × 10⁶ = m' × 4.18 × ( 300 - 292 )

66.667 × 10⁶ = m' × 33.44

m' = ( 66.667 × 10⁶ ) / 33.44

m' = 1993630.38 kg/s

Therefore, the required flow rate is 1993630.38 kg/s

7 0
3 years ago
Technician a s ays a shorted circuit can generate excessive heat. technician b says a shorted circuit will cause the circuit pro
Lerok [7]

Based on the information provided, the technician who is correct is: C. Both Technician A and Technician B.

<h3>What is an open circuit?</h3>

An open circuit can be defined as a type of electric circuit in which the continuity between the conducting wire (paths) has been broken or cut.

This ultimately implies that, an open circuit is designed and developed to prevent the flow of electric charges (electrons or currents) from one point in an electric circuit to another.

In Electrical engineering, a short usually causes an electric circuit protection device such as a fuse, circuit breaker, etc., to open when higher than normal current flows through the electrical circuit.

Read more on short circuit here: brainly.com/question/25018411

#SPJ1

Complete Question:

Technician A says a shorted circuit can generate excessive heat. Technician B says a shorted circuit will cause the circuit protection device to open. who is correct?

A. Technician A only

B. Technician B only

C. Both Technician A and B

D. Neither Technician A nor B

5 0
1 year ago
What razor-thin country accounts for more than half of the western coastline of South America?
frez [133]

Chile is the razor thin country you're talking about.

Why? Because Chile accounts more than half of the western coastline of South America.

Why again you ask? Well that's easy. Chile stands with a palatable coastline of about 2,600 miles.

5 0
3 years ago
Consider a steady flow Carnot cycle with water as the working fluid. The maximum and minimum temperatures in the cycle are 350 a
nadya68 [22]

Answer:

η = 48.1 %

Explanation:

Given that

The maximum temperature ,T(max) = 350 C

T(max) = 350+ 273 = 623 K

The minimum temperature ,T(min) = 50 C

T(min) = 50 + 273 = 323 K

We know that efficiency of Carnot cycle is given as

\eta=1-\dfrac{T_{min}}{T_{max}}

Now by putting the values in the above equation we get

\eta=1-\dfrac{50+273}{350+273}\\\eta=0.481

The efficiency of Carnot cycle will be 48.1 %.

Therefore the answer will be 48.1 %.

η = 48.1 %

4 0
3 years ago
Answers of science book<br><br>​
vitfil [10]

Answer:  answers of science book  is to help you

Explanation: if there are answer in a science book use them there for a reason

6 0
3 years ago
Other questions:
  • A rigid tank having 25 m3 volume initially contains air having a density of 1.25 kg/m3, then more air is supplied to the tank fr
    12·1 answer
  • 1. (5 pts) An adiabatic steam turbine operating reversibly in a powerplant receives 5 kg/s steam at 3000 kPa, 500 °C. Twenty per
    12·1 answer
  • What is Euler's equation?
    6·1 answer
  • 4. Lockout/tagout (LOTO) is a safety procedure that ensures dangerous machines are properly shut off and not started up again pr
    13·1 answer
  • What Happens If A Sonic Boom Is Created?
    8·1 answer
  • Heating of Oil by Air. A flow of 2200 lbm/h of hydrocarbon oil at 100°F enters a heat exchanger, where it is heated to 150°F by
    7·1 answer
  • Can someone draw a electric circuit with electrical symbols for this
    13·2 answers
  • Deidre has just moved from the sales department into the finance department. On her first day in her new role, she receives an e
    14·1 answer
  • A train travels 650 meters in 25 seconds. What is the train's velocity?
    9·1 answer
  • the highway department is to design a roadway over a swamp area. the swamp consists of very soft fine-grained soils obviously sa
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!