Question

MATLAB Write the proper 'display header' for each part. Give a short comment in front of...

MATLAB

Write the proper 'display header' for each part. Give a short comment in front of each line as needed.

(1a)-Create a variable calls final_value which is holding a value of 30.

(1b)-Create a row vector from 20 to the final_value with an increment of 8.(Do not use the value of final_value). Next, assign this vector to a variable calls row_vec1.

(1c)-Use the length() function to create another row vector using linspace() from 2 to 56 and assign it to another variable calls row_vec2 in a way that row_vec2 can be appended to the top of row_vec1.

(1d)-Append row_vec2 to the top of row_vec1 vector and assign it to a variable calls matrix1.

(1e)-Append matrix1 to the bottom of row_vec1 vector and call it matrix2. Change the value of the final_value to a new value (to the smallest number possible) that your output becomes a 3x4 matrix and assign this matrix to a variable calls matrix3

(1f)-swap column 4 of matrix2 with column 1. This is your final output.

(1g)-Compare matrix2 and matrix3 by generating a Boolean matrix to see which elements are equal. (1 if equal and 0 if they are not)  

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

%matlab code

%(1a)-Create a variable calls final_value which is holding a value of 30.

final_value = 30

%(1b)-Create a row vector from 20 to the final_value with an increment of 8.

%Next, assign this vector to a variable calls row_vec1.

row_vec1 = [20:8:30]

%(1c)-Use the length() function to create another row vector using

%linspace() from 2 to 56 and assign it to another variable calls row_vec2

%in a way that row_vec2 can be appended to the top of row_vec1.

row_vec2 = linspace(2, 56, 2)

%(1d)-Append row_vec2 to the top of row_vec1 vector and assign it to a

%variable calls matrix1.

matrix1 = [row_vec2; row_vec1]

And the output screenshot is:

MATLAB Window Help Θ @ 1.40 GB (9 0 (D < >丶令[ 66%)T Q.。Е Tue 19 Sep 08:05 MATLAB R2013a ANANDA KUMAR THUMMAPUDI EDITOR PUBLIS


Please post separate question for remaining parts.

Add a comment
Know the answer?
Add Answer to:
MATLAB Write the proper 'display header' for each part. Give a short comment in front of...
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
  • Matlab code assistance - task 1 and 6 I think I am right and just need...

    Matlab code assistance - task 1 and 6 I think I am right and just need to be pointed in the right direction if I should change anything %% Task 1 % create the 3 row vectors shown in Ex 8 using 3 different approaches Ex 8 = using the colon operator and also the linspace function, create the following row vectors -5 -4 -3 -2 -1 5 7 9 8 6 4 % 1. list the values explicitly (square...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts...

    MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...

  • Part 1: Using Idle Write a Python Script that Does the Following 1. At the top...

    Part 1: Using Idle Write a Python Script that Does the Following 1. At the top of your program, import the math library as in from math import * to make the functions in the math module available. Create a variable and assign into it a constant positive integer number of your choice. The number should be at most 10. 1 Suppose we call this variable x for this writeup document Try something like x = 4 2. Create another...

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