Discover
Questions library
Collections library
Find online teacher
login
Discover
questions library
Find online teacher
login
MATLAB: A Practical Introduction to Programming and Problem Solving
by
Stormy Attaway
Edition:
Fourth Edition
ISBN13:
ISBN10:
459
Matlab
Home
Books
MATLAB: A Practical Introduction to Programming and Problem Solving
Similar Books
No books found
Title
Chapter: 5 /
Q: 5.5
Write a function sumsteps2 that calculates and returns the sum of 1 to n in steps of 2, where n is an argument passed to the function. For example, if 11 is passed, it will return 1 + 3 + 5 + 7 + 9 + 11
Chapter: 5 /
Q: 6.5
Write a function prodby2 that will receive a value of a positive integer n and will calculate and return the product of the odd integers from 1 to n (or from 1 to n-1 if n is even). Use a for loop
Chapter: 5 /
Q: 7.5
Write a script that will: generate a random integer in the inclusive range from 2 to 5 loop that many times to o prompt the user for a number o print the sum of the numbers entered so far with one decimal place
Chapter: 5 /
Q: 8.5
Write a script that will load data from a file into a matrix. Create the data file first, and make sure that there is the same number of values on every line in the file so that it can be loaded into a matrix
Chapter: 5 /
Q: 9.5
Write code that will prompt the user for 4 numbers, and store them in a vector. Make sure that you preallocate the vector!
Chapter: 5 /
Q: 10.5
Write a for loop that will print the elements from a vector variable in sentence format, regardless of the length of the vector. For example, if this is the vector:
Chapter: 5 /
Q: 11.5
Execute this script and be amazed by the results! You can try more points to get a clearer picture, but it may take a while to run
Chapter: 5 /
Q: 12.5
A machine cuts N pieces of a pipe. After each cut, each piece of pipe is weighed and its length is measured; these 2 values are then stored in a file called pipe.dat (first the weight and then the length on each line of the file)
Chapter: 5 /
Q: 13.5
Come up with “trigger” words in a problem statement that would tell you when it’s appropriate to use for loops and/or nested for loops
Chapter: 5 /
Q: 14.5
With a matrix, when would: your outer loop be over the rows your outer loop be over the columns it not matter which is the outer and which is the inner loop?
total questions:
459
Previous
14
15
16
17
18
Next
Questions
459
Views
Best Answers
299
Points
5
×
Close
add reason
reason