Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE

USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!! USE MATLAB!!

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Create a big matrix with submatrices: The following matrix G is created by putting matrices A,B, and C, given previously, on its diagonal. In how many ways can you create this matrix using submatrices A,B, and C (that is, you are not allowed to enter the nonzero numbers explicitly)? G=230000690000001300002400000055000053. 6. Manipulate a matrix: Do the following operations on matrix G created in Exercise 4. - Delete the last row and last column of the matrix. - Extract the first 44 submatrix from G. - Replace G(5,5) with 4. - What do you get if you type G(13) and hit return? Can you explain how MATLAB got that answer? - What happens if you type G(12,1)=1 and hit return? Do exercises \#4 and \# 5 from page 42, this time as a script. In \#4 make sure to show as many solutions as you can think of to the problem. (None of these solutions should be typing in the matrix verbatim!) Exercise 2: Write a script that asks as input 2 numbers, a and b. The script then calculates the addition, subtraction, multiplication, division, power, and square root between the two numbers (a+b, ab..).Foreachoneusethe "disp" command to display the result in a form of a sentence. Exercise 3: In the script you wrote for exercise 2, comment out the line asking for a user input and replace it by the following: - ask the user to choose a single number. - generate two random integers between 1 and the input number. - have the script "tell" the user what these two integers are. Exercise 4: Write a script that asks for a single input number. Calculate the sum of all integers between 1 and the input number. Then calculate the sum of all even numbers, then the sum of all odd numbers between 1 and the input number. Lastly, calculate the sum of all numbers between 1 and the input number after they are all squared. Neatly. present your four results using the "disp" command. Exercise 5: Write a script that asks for two integers m and n, and then asks for a vector of length mn. It then turns the vector into an mn matrix, and also into an nm matrix. Exercise 6: Write a script similar to the one you wrote for Exercise 4 above, except instead of the sum of numbers calculate the multiplication of all numbers by each other. For example, if you have a vector [12345], your script will calculate 12345=120, then 24=8 for the evens and 135=15 for the odds. Do not use the "prod" command for this, or any other command that allows you to do it directly (like the "sum" command in Ex. 4). Write a script that prompts the user for a value in some range (for example, between 3 and 7). As long as the value is not within the range or a number has not been provided, the script keeps prompting the user for that number. As soon as a valid number is entered, the script then displays a string that tells the user what the number is (for example "The number you have chosen is 5")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions