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
kirill115 [55]
3 years ago
14

Given an input array of strings (characters) s, pick out the second column of data and convert it into a column vector of data.

Missing data will be indicated by the number 9999. If you encounter missing data, you should set it to the average of the immediately neighboring values. (This is a bit simpler than using `interp1`.)
If the input array is s = [ 'A' '0096' ; 'B' '0114' ; 'C' '9999' ; 'D' '0105' ; 'E' '0112' ]; then the output variable `t` is the following column vector. t = [96 114 109.5 105 112]';
Compose a function read_and_interp which accepts an array in the above format and returns the data converted as specified. You may find the conversion function `str2num` to be useful.
(Using MATLAB Syntax only)
Computers and Technology
1 answer:
hodyreva [135]3 years ago
7 0

Answer:

Consider the following code.

Explanation:

save the following code in read_and_interp.m

 

function X = read_and_interp(s)

[m, n] = size(s);

X = zeros(m, 1);

for i = 1:m

if(str2num(s(i, 2:5)) == 9999)

% compute value based on previous and next entries in s array

% s(i, 2:5) retrieves columns 2-5 in ith row

X(i,1) = (str2num(s(i-1 ,2:5)) + str2num(s(i+1,2:5)))/2;

else

X(i,1) = str2num(s(i,2:5));

end

end

end

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

Now you can use teh function as shown below

s = [ 'A' '0096' ; 'B' '0114' ; 'C' '9999' ; 'D' '0105' ; 'E' '0112' ];

read_and_interp(s)

output

ans =

96.000

114.000

109.500

105.000

112.000

You might be interested in
Which of the following are the rows or columns of white space created between grids?
erma4kov [3.2K]
It would be margins. none of the others are even terms for anything.
4 0
3 years ago
What is the function of HTML?
Anastaziya [24]

Explanation:

HTML is used to create web pages, documents.

hope this helps u

4 0
2 years ago
Read 2 more answers
Who here has an old (preferably 80s) Toyota Celica i just bought mine and want to know how you guys like yours because mine is f
Maurinko [17]

Answer:

Explanation:

The 1980 Toyota Celica is a great car, it was my first car and I loved it. It has many luxury features that you don't see much in cars of that year. It is also extremely reliable and can take lots of use before beginning to give problems. I used to use it to get to and from school on a daily basis and it never once left me stranded. It includes power steering, cruise control, AC, etc. Not much more you can ask for in a car, it is also a very beautiful looking car, especially a well taken care of one. Enjoy your car.

8 0
2 years ago
What is the correct name for the words Home, Insert, Design, Layout, References, etc. in the ribbon in Word 2016?
larisa86 [58]

Answer:

tabs

Explanation:

Microsoft Word refers to a word processing software application or program developed by Microsoft Inc. to enable its users to type, format and save text-based documents.

The commands which are used in Microsoft Word 2016 are displayed using series of icons that are stored on different tabs.

A ribbon is a combination of icons and tabs. In Microsoft Word 2016, the correct name for the words Home, Insert, Design, Layout, References, View, Mailings, and Review in the ribbon is tabs.

Tabs are a section of the Microsoft Word application that avails end users the opportunity to perform certain tasks such as formatting a text, changing the layout, clipboard, paragraph, styles, tables, page setup, inserting a theme, applying color, editing and inputting footnotes, header, citation and bibliography, etc.

8 0
3 years ago
Ask the user for five-coordinate pairs. Store each pair as a tuple, and store all the pairs in a list. Print the slope between a
Margaret [11]

Answer:

y=(1/2) x+3

Explanation:

8 0
2 years ago
Other questions:
  • A ____ is harmful computer code that spreads without your interaction, slipping from one network to another and replicating itse
    15·1 answer
  • Business Risks are ​
    15·1 answer
  • In modern computer memory, each location is normally composed of one byte.
    7·1 answer
  • As the demand for goods and services increases, job growth _____. a. increases b. decreases c. remains the same d. none of the a
    15·2 answers
  • In a linked chain implementation of a queue, the performance of the enqueue operation
    10·1 answer
  • which of the following cells can't be recarged? A. Electrode cell B. wet cell C. primary cell D. storage cell
    13·1 answer
  • Given a number count the total number of digits in a number
    12·1 answer
  • What are some of the ways we can resolve IPv4 address shortages? Check all that apply.
    13·1 answer
  • Make variables to represent the length and width of a rectangle, called length and width, respectively. You should set length to
    7·1 answer
  • The famous arcade game Space Invaders was first adapted to which home console?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!