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 0:18 ID:azZEeofA

dunno 'bout matlab specifically, but here's some pseudocode
should get you on the right track


n = (get a number)
minimum = n
maximum = n
sum = n
count = 1

loop {
    n = (get another number)
    sum = sum + n
    count = count + 1
    if n < minimum then n = minimum
    if n > maximum then n = maximum
}
average = sum / count

Name: Anonymous 2007-04-26 3:30 ID:t29qmFuq

zomg MATLAB TORRENT NAO PLOX

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.

Name: Anonymous 2007-04-26 6:23 ID:FW0MKUdT

silly assignment, in matlab you should use builtins for everything

Name: Anonymous 2007-04-26 6:37 ID:1l2lVO/9

>>4
What is this 'redefine' crap? Get that maths out of your head, you're in /prog/ now.

Name: Anonymous 2009-01-14 14:27

LISP

Name: Anonymous 2009-03-06 5:50

Simple vertical shooter games   in QBasic on   a shitty 12mhz.

Name: Anonymous 2009-03-06 8:59


PLOX plix plox pl0xplix   plix plix plox   pl0xplix plix plix   plix plox plox   pl0x pl0x plox   plix plox pl0xplix   plix plix plox   pl0xplix plix plix   plix plox plox   pl0x pl0x plox   plix plox pl0xplix   plix plix plox   pl0xplix plix plix   plix plox plox   pl0x pl0x plox   plix plox pl0xplix   plix plix plox   pl0xplix plix plix   plix plox plox   pl0x pl0x plox   plix plox pl0xplix   plix plix plox   pl0xplix plix plix   plix plox plox!

Name: Anonymous 2010-06-22 18:15

dicks

Name: Anonymous 2010-06-22 18:15

dicks

Name: Anonymous 2010-12-27 10:53

Name: Sgt.Kabuﭒ靸kiman蓫沪 2012-05-29 0:49

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

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