Write a function called makemat that will receive two row vectors as input arguments, and from them create and return a matrix with two rows. You may not assume that the length of the vectors is known. Also, the vectors may be of different lengths. If that is the case, add 0's to the end of one vector first to make it as long as the other. For example, a call to the function might be:
Write a function called makemat that will receive two row vectors as input arguments, and from them create and return a matrix with two rows. You may not assume that the length of the vectors is known. Also, the vectors may be of different lengths. If that is the case, add 0's to the end of one vector first to make it as long as the other. For example, a call to the function might be:
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
Related questions
Question
Matlab Question
![Write a function called makemat that will receive two row vectors as input arguments, and from them
create and return a matrix with two rows. You may not assume that the length of the vectors is known.
Also, the vectors may be of different lengths. If that is the case, add 0's to the end of one vector first to
make it as long as the other. For example, a call to the function might be:](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbb1e9de9-a728-40ac-94a8-c6bce5f72bed%2Fcf09015c-2bcb-4f6d-bd80-4f927bb6c0b9%2F65ckpc9_processed.png&w=3840&q=75)
Transcribed Image Text:Write a function called makemat that will receive two row vectors as input arguments, and from them
create and return a matrix with two rows. You may not assume that the length of the vectors is known.
Also, the vectors may be of different lengths. If that is the case, add 0's to the end of one vector first to
make it as long as the other. For example, a call to the function might be:
![makemat (1:5,1:10)
ans =
1
1
2
2
3
3
4
4
5
5
0
6
7
0
8
0
9
1
0
In your script, test out your function with two input vectors: x1=1:6; x2=1:10;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbb1e9de9-a728-40ac-94a8-c6bce5f72bed%2Fcf09015c-2bcb-4f6d-bd80-4f927bb6c0b9%2Fej9u1qk_processed.png&w=3840&q=75)
Transcribed Image Text:makemat (1:5,1:10)
ans =
1
1
2
2
3
3
4
4
5
5
0
6
7
0
8
0
9
1
0
In your script, test out your function with two input vectors: x1=1:6; x2=1:10;
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning