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
The engine type that is fired by gas or oil
salantis [7]
Internal combustion is the answer
8 0
3 years ago
Read 2 more answers
Nat is defined in rfc ____, which describes methods for connecting private (internal) ip addresses to the internet.
algol13
Describing methods for connecting private (internal) IP addresses to the internet using NAT was defined in RFC 3022. NAT has servers that use port forwarding to send connections from external clients to the Web server on the internal network. NAT is used on routers to hide internet IP address from the internet.



7 0
3 years ago
Best gaming chairs under 150 (facts)​
adelina 88 [10]

Answer:

IKEA ÖRFJÄLL/SPORREN Swivel Chair, White, Vissle Light Green 191.623.75

Explanation:

it's Ikea

7 0
3 years ago
What is the different between compilers and interpreters?​
ad-work [718]
Compiler transforms code written in a high-level programming language into the machine code, at once, before program runs, whereas an Interpreter coverts each high-level program statement, one by one, into the machine code, during program run. Compiled code runs faster while interpreted code runs slower.
8 0
3 years ago
Unauthorized use of information, materials, devices, or practices in completing academic activities is generally considered:
sasho [114]

Answer: Cheating

Explanation: Cheating involves unauthorized use of information, materials, devices, sources or practices in completing academic activities. For example, copying during an exam that should be completed individually is an unauthorized practice, and, therefore, is considered cheating.

8 0
2 years ago
Read 2 more answers
Other questions:
  • What is the key benefit of using RAM in a computer?
    12·1 answer
  • What method of malware infection installs malware through use of a separate browser window that opens uninvited from a Web page?
    7·2 answers
  • Disk ________ realigns separated data so that related file pieces are unified.
    6·1 answer
  • Who conceptualizes the design and the working of a website
    15·1 answer
  • Diane is receiving a lot of unwanted e-mail. What steps can she take to reduce the amount of e-mail she receives?
    12·1 answer
  • If I have an Animal superclass with a Mammal subclass, both concrete and both having a method called eat() with identical signat
    15·1 answer
  • Which button would you use to insert a downloaded video clip on your computer into a slide?
    15·2 answers
  • Don't click on this I am testing
    7·2 answers
  • Plz subscribe my yt gaming channel <br>FIREAZZ GAMING​
    8·2 answers
  • Manufacturing product designs must be tested before they are put into production. Who is responsible for this?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!