Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 01: Defining, accessing, and manipulating arrays. a. Write the command that defines a 2D array (matrix of 3 rows and 3 columns), use variable

Problem 01: Defining, accessing, and manipulating arrays. a. Write the command that defines a 2D array (matrix of 3 rows and 3 columns), use variable name golf, and fill the first row with odd numbers, and fill the second row with even number, and fill the third row with prime numbers. b. Create another array, use variable name biggolf which is filled with the square of each value of golf plus 15. Problem 02 Part a Given the following code: for i=1:5 for j=1:5 if i==j m(i, j)=1; else m(i, j)=0; end end end disp(m) Show below what would be displayed when the code is executed. Problem 03 Part a: funloops.m is written as follow prod = 0; for i = 1:10 prod = prod * 2*i; ii=i+1; end When the code is executed the following error is displayed to the command window: >> reducetoone(20) Undefined function or variable "ii".

Error in funloops (line 4) ii=i+1; a. Correct the code above so that the code will run without error. Problem 04: WRITE CODE: Part a: Write a script to sum the series 1 + 2 + 3 + ... , the sum should not exceed 99. The program should display how many terms are used in the sum.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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