Simple For loop instructions. The following script should compute and display ten values of y=mx+b with x having integer values. Find the error in the script.

m = 3;
b = 1;
for i = 0:9
y(i) = m*i+b;
end
y


Solution
m = 3;
b = 1;
for i = 1:10 % <- array indexing starts with 1
y(i) = m*i+b;
end
y

Trades & Technology

You might also like to view...

One thing you can do to improve the quality of your pictorial sketches is to include ____________________ on selected surfaces to make them stand out from other surfaces or to provide clarity for the viewer.

Fill in the blank(s) with the appropriate word(s).

Trades & Technology

With the engine running and the transmission in ____________________, if resting your foot on the pedal produces a noise, the release bearing is probably bad.

Fill in the blank(s) with the appropriate word(s).

Trades & Technology

The symbol ? is an abbreviation for 10-6 or micro

Indicate whether the statement is true or false

Trades & Technology

Prescriptive-type tables for use in project specifications have been developed by the _____

a. American Cement Specification Board b. American Concrete Institute c. American Concrete Council d. American Cement Manufacturers? Association

Trades & Technology