Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help with random number generator in matlab

Subject: Help with random number generator in matlab

From: Alex

Date: 12 Apr, 2009 14:53:01

Message: 1 of 3

I need to make a random number generator using matlab, I could have chose to use mathmatica but I find matlab easier to use. Well anyway I have created a m file in matlab
where d is the number I want to to go to, I have chosen I(1) and I(2) and I need it to get I(1) to I(d) and then put it in a series. This is the first time ive used series in matlab and I need some help.
m file:

n = 2:(d - 1)
I(1) = 1
I(2) = 1
I(n+1) = n*A + B*I(n)*I(n-1)

Can anyone give me push in the right direction, thanks

Subject: Help with random number generator in matlab

From: Nasser Abbasi

Date: 12 Apr, 2009 15:25:57

Message: 2 of 3


"Alex" <a.shan@hotmail.co.uk> wrote in message
news:grsv8d$sol$1@fred.mathworks.com...

This is the first time ive used series in matlab and I need some help.
> m file:
>
> n = 2:(d - 1)
> I(1) = 1
> I(2) = 1
> I(n+1) = n*A + B*I(n)*I(n-1)
>
> Can anyone give me push in the right direction, thanks

You did not give values for A, B, but may be you want a loop?

d=5;
A=1;B=2;
I=zeros(d,1);
I(1) = 1;
I(2) = 1;

for n = 2:(d - 1)
  I(n+1) = n*A + B*I(n)*I(n-1);
end

I =
     1
     1
     4
    11
    92

Subject: Help with random number generator in matlab

From: dpb

Date: 12 Apr, 2009 18:15:43

Message: 3 of 3

Alex wrote:
> I need to make a random number generator using matlab, ...
>
> Can anyone give me push in the right direction, thanks

I'd push

lookfor random

then

doc 'whichever_generator_you_need'

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us