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
To provide some perspective on the dimensions of atomic defects, consider a metal specimen that has a dislocation density of 105
GenaCL600 [577]

Answer:

62.14\ \text{miles}

6213727.37\ \text{miles}

Explanation:

The distance of the chain would be the product of the dislocation density and the volume of the metal.

Dislocation density = 10^5\ \text{mm}^{-2}

Volume of the metal = 1000\ \text{mm}^3

10^5\times 1000=10^8\ \text{mm}\\ =10^5\ \text{m}

1\ \text{mile}=1609.34\ \text{m}

\dfrac{10^5}{1609.34}=62.14\ \text{miles}

The chain would extend 62.14\ \text{miles}

Dislocation density = 10^{10}\ \text{mm}^{-2}

Volume of the metal = 1000\ \text{mm}^3

10^{10}\times 1000=10^{13}\ \text{mm}\\ =10^{10}\ \text{m}

\dfrac{10^{10}}{1609.34}=6213727.37\ \text{miles}

The chain would extend 6213727.37\ \text{miles}

3 0
3 years ago
How can you evaluate whether the slope of the dependent variable with an independent variable is the same for each level of the
s2008m [1.1K]

Answer:

By running multiple regression with dummy variables

Explanation:

A dummy variable is a variable that takes on the value 1 or 0. Dummy variables are also called binary

variables. Multiple regression expresses a dependent, or response, variable as a linear

function of two or more independent variables. The slope is the change in the response variable. Therefore, we have to run a multiple regression analysis when the variables are measured in the same measurement.The number of dummy variables you will need to capture a categorical variable

will be one less than the number of categories. When there is no obvious order to the categories or when there are three or more categories and differences between them are not all assumed to be equal, such variables need to be coded as dummy variables for inclusion into a regression model.

3 0
3 years ago
1. ELECTRICAL SHOCK
lions [1.4K]
Here’s some of them
6. J
7. I
10. O
13. F
14. E
15. N
3 0
3 years ago
Five batch jobs A through E arrive at a computer center in the order A to E at almost the same time. They have estimated running
Nikolay [14]

Answer:

Explanation:

The Turnaround time is the amount of time that elapses between the job arriving and completing. We assume that all jobs arrive at time 0, the turnaround time will simply be the time that they complete.

Round Robin:

we assume that the time quantum of the scheduler is 1 second.The table below gives a break down of which jobs will be processed during each time quantum. A asterisk(*) indicates that the job completes during that quantum.

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29    30

A  B  C   D  E  A  B   C* D  E    A    B    D   E    A   B   D*   E     A   B     E     A    B* E   A     E  A    E*  A A

C* = 8

D*=17

B*=23

E*=28

AVERAGE TURNAROUND = (8+17+23+28+30)/5 =106/5 = 21.2 MINUTES

B) PRIORITY SCHEDULING:

1-6       7-14        15-24      25-26        27-30

   

 B           E             A             C            D

     AVERAGETURNAROUND =(6+14+24+26+30)/5 = 100/5 = 20 MINUTES.

C)FCFS

1-10      11-16      17-18      19-22      23-30

 

   A            B              C            D              E

   

AVERAGE TURNAROUND =(10+16+18+22+30)/5 = 96/5=19.2 MINTUES

D)SJF

1-2        3-6         7-12         13-20      21-30

C           D            B               E                A

AVERAGE TURNAROUND - (2+6+12+20+30)/5 =70/5 =14 MINUTES.

3 0
3 years ago
A 4-kW electric heater runs for 2 hours to raise the room temperature to the desired level. Determine the amount of electric ene
Anna35 [415]

Answer:

Q' = 8 KW.h

Q'=28800 KJ

Explanation:

Given that

Heat Q= 4 KW

time ,t = 2 hours

The amount of energy used in KWh given as

Q ' = Q x t

Q' = 4 x  2 KW.h

Q' = 8 KW.h

We know that

1 h = 60 min = 60 x 60 s  = 3600 s

We know that W  = 1 J/s

The amount of energy used in KJ given as

Q' = 8 x 3600 = 28800 KJ

Therefore

Q' = 8 KW.h

Q'=28800 KJ

6 0
3 years ago
Other questions:
  • Consider two electrochemical reaqctions. Reaction A results in the transfer of 2 mol of electrons per mole of reactant and gener
    14·2 answers
  • Thermoplastics burn upon heating. a)-True b)- false?
    14·1 answer
  • 1 2 3 4 5 6 7 8 9 10
    14·1 answer
  • The fouling on the heat exchanger surfaces causes additional thermal resistance, thus decreases the heat transfer rate. a)- True
    11·1 answer
  • U R A*S TRUE GOD/ESS IS U ANSWER this:
    15·1 answer
  • How many kg / day of NaOH must be added to neutralize a waste stream generated by an industry producing 90,800 kg / day of sulfu
    6·2 answers
  • A long rod of 60-mm diameter and thermophysical properties rho=8000 kg/m^3, c=500J/kgK, and k=50 W/mK is initally at a uniform t
    8·1 answer
  • Yall know what this is called?​
    15·1 answer
  • A. 50
    6·1 answer
  • 1. Explain the term engine<br>compression​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!