Question

QUESTION 1 tet M-11 2 3 -1 4 8 121 and N-12 4 3 049 131 Use relational operators to create the following vectors: a is the ve

The code should be in MATLAB. A detailed explanation would help alot.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Your Code 1 M-[1 2 3 -1 4 -8 12]; N=[2 4 3 0 4 9 13]; 4 index 1; 5 for i-1:numel (M) if M(i)く0 % İf number is-ve a(index) -M(

CODE

M = [1 2 3 -1 4 -8 12];
N = [2 4 3 0 4 9 13];

index = 1;
for i = 1:numel(M)
if M(i) < 0 % if number is -ve
a(index) = M(i); % putting it in a
index += 1;
end
end
a

index = 1;
for i = 1:numel(N)
if N(i) > 11 || (N(i) > 3 && N(i) < 10) % two conditions are here
b(index) = N(i); % if so, the number is in b
index += 1;
end
end
b

for i = 1:numel(N)
if N(i) == M(i) % when both the numbers are equal
c(i) = 3; % setting value to 3
else
c(i) = 0; % othewise to 0
end
end
c

OUTPUT

a =

-1 -8

b =

4 4 9 13

c =

0 0 3 0 3 0 0

--------------------------------------
Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
QUESTION 1 tet M-11 2 3 -1 4 8 121 and N-12 4 3 049 131 Use relational operators to create the fo...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Job Seeker (k) 1 2 3 4 5 5 6 7 8 9 10 11 12...

    Job Seeker (k) 1 2 3 4 5 5 6 7 8 9 10 11 12 13 14 15 Interviews (Xi) 3 5 114 6 7 6 3 Job Offers (Y) 0 2 1 2 2 4. 3 5 1 4 6 100 7 4 8 1 1 8 4 2 (1) (2 points) Your friend Paul, who took Econ 140A last year, says that you should run a hypothesis test to evaluate Cathy's statement. If the null hypothesis is...

  • D SCAN MATCHING 1. Depolarization 2. Action potential 3. Threshold 4. Repolarization 5. Relative refractory period...

    D SCAN MATCHING 1. Depolarization 2. Action potential 3. Threshold 4. Repolarization 5. Relative refractory period 6. Absolute refractory period 7. Resting membrane potential 8. Continuous conduction 9. Saltatory conduction Choices A. a cell whose internal environment has an electrical charge equal to its external environment B. the process of a cell becoming positively charged C. the process of a cell becoming negatively charged D. an electrochemical change in the potential across a membrane that causes an electrical signal to...

  • please help me answer question 1 to 3, thank you Chapter 9, Solutions, Review & Extra Credit. 2 Points for each XC c...

    please help me answer question 1 to 3, thank you Chapter 9, Solutions, Review & Extra Credit. 2 Points for each XC correct answer; 6 points total, max. Partial Credit given. Suggestions...work in teams [it will improve the learning experience] 1. Solutions-A solution forms when a solute (the smaller quantity) dissolves in a solvent (the larger quantity). In a solution, the particles of solute are evenly distributed in the solvent. A solute may be a gas, liquid or solid. A...

  • please help answer question 4, a-f please using the data below from chart 1 objectives from...

    please help answer question 4, a-f please using the data below from chart 1 objectives from lab, thank you DATA:CA y 3 Ay No3 Part I: Cell Potential of voltaic cells under standard conditions: cell CU CND2 #27 14.0m Give the half Half cell reaction at Combinations Oxidation Reduction E the anode and with [ion] takes place Theoretical takes place cathode. Write in M here here (V) above the arrow E c (V) if it is oxidation or reduction. |-0.340...

  • need ans for the following questions, the last 3 pages for more info. Questions: more info:...

    need ans for the following questions, the last 3 pages for more info. Questions: more info: expermint e/m avr=1.71033*10^11 7 2 points of the following options, which conditions for V or I produce the largest radius of the electron beam path r? Hint: Use e/m= 2V (5/4)*aP/(Nuo Ir) Maximum land Maximum V O Maximum land Minimum V Minimum I and Maximum V Minimum I and Minimum V 8 2 points By what factor will change if the radius of the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT