Question

MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when c...

MATLAB QUESTION

Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when called, it gives control to the user and asks the user to input a length-3 vector. Then the function prints:

The sum of ___, ____, and ____ is ____. [new line]

where the first three blanks are filled by each element in input vector, and the last blank is the sum of all three elements.

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

function vector_input()

A=input('Enter vector of length in form[a b c]') ;

S=sum(A) ;

fprintf('\nThe sum of %d %d and %d is %d', A(1), A(2), A(3), S)

end

Add a comment
Know the answer?
Add Answer to:
MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when c...
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
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