[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creation of fuction y=0
From: |
Bill Denney |
Subject: |
Re: Creation of fuction y=0 |
Date: |
Wed, 04 Jun 2008 23:11:45 -0400 |
User-agent: |
Thunderbird 2.0.0.14 (Windows/20080421) |
Doug Stewart wrote:
alvaro gonzalez wrote:
Hi People.
My problem is I want create in a time-series about variability,
up-down above 0 (as y=0 represent to line), but the vector 0 I don't
know create!!!. the form that is create to matriz produce error!!!.
y(1000) =0;
a= rand(1000)-.5;
y=y+a;
Is this what you want?
The a = rand(1000) will create a 1000x1000 matrix of random numbers.
The direct way to do it is just
a = rand(1000,1) - 0.5;
If you have an existing vector, a simpler way to do it is:
y = zeros(1000,1);
a = rand(1000,1) - 0.5;
y = y + a;
And actually that last line can be written as
y += a;
Have a good day,
Bill