The Student Room Group

matlab, uni?

What does

cwk=ceil(randn(1,50)*15+55);


mean in english??
Reply 1
I imagine cwk is the name of a variable.

"ceil" is the ceiling function, which takes the smallest integer greater than or equal to a number. For example, ceil(3) = 3 and ceil(3.1) = 4.

randn(1,50) takes a random number between 1 and 50 (not necessarily an integer, hence the need for the ceil)

I'd hope that + and * are obvious.

So all in all, "cwk = ceil(randn(1,50)*15+55);" gives 15n+55\lceil 15n+55 \rceil, where nn is a random number between 1 and 50.
(edited 13 years ago)
Reply 2
ahhh

thanks :smile:
Reply 3
Original post by Farhan.Hanif93
Typo I presume but I think you mean that n is a number between 1 and 50, as opposed to between 1 and 55.


Yup.
Reply 4
just to establish:


cwk = ceil(randn(2,397)*185+12)

would be (185n+12) where n is a rnadom number between 2 and 397?
Original post by elldeegee
just to establish:


cwk = ceil(randn(2,397)*185+12)

would be (185n+12) where n is a rnadom number between 2 and 397?

Yes.

Quick Reply

Latest