Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

matlab

Name: Anonymous 2007-04-25 23:08 ID:mq92LVE1

using matlab, i'm to create a program that takes a set of user-input integers, then returns the largest, smallest, sum, and average. here's the catch: i can't use any built-in functions. so i can't just type in min, max, or mean.

my little programming experience has been with expanding on built-in functions, so i have no idea how REAL programming works. i assume it's some kind of loop, but i can't fathom how to create such a loop. i bet someone here will know exactly how to do this in matlab, but if you can just shed some light on how to create your own functions from scratch, that might help me understand.

Name: Anonymous 2007-04-26 6:11 ID:MT1nUf/o

>>2
i think i'm starting to understand. loop the user input, redefining my three outputs each time a new number is entered. sum is redefined each time a number is input, adding the new input. min is defined as the first number input, then redefined if the newest number is smaller. max works similarly. average is just sum/number of loops + 1.

that's great. simple as it is, i probably wouldn't have come up with it on my own.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List