help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mathlab code to run in Octave


From: Michael Grossbach
Subject: Re: Mathlab code to run in Octave
Date: Thu, 08 Jan 2009 17:23:37 +0100
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

frederic manseau wrote:
Hi,

I am a new user of Octave with next to no experience in programming and I
would like to have some advice as I am trying to use the following Matlab
codes, which someone told me should work fine in Octave:

%generate 10000 gaussian random numbers

y=randn(10000,1);

% look at a histogram to see that they are in fact gaussian distributed

hist(y,100);

%plot the raw data trace;

plot (y)

generate a time series from 0 to 500 ms steping by 1 ms;

f=(1:500)/1000;

generate the alpha function

%0.003 = 3 ms;

tau=.003;

f1=exp(-f/.003).*f;

%plot the alpha function to make sure it looks like what you want

plot(f1)

now convolve the data set (y) with the alpha function (f1)

y1=conv(y,f1);

%open a new figure window

figure

%plot the new signal

plot(y1)

I have tried to run this several times but unfortunately I can't get passed
the command line number 7.

I have highlighted (in red) the parts of the code that seem to be causing
the problem. I understand for instance that that the '%' in line 5 is just
to attribute the value 3ms to the time scale but I guess there must be an
equivalent operator for % in Octave because this one clearly doesn't work. I
would greatly appreciate any help on this.

Thank you very much!

Works for me with Octave 3.0.3 under Windows. Maybe you forgot to comment out the lines
generate a time series from 0 to 500 ms steping by 1 ms;
and
generate the alpha function
?
Which one is line 5 you can't get past? I.e. how do you count line numbers, including comment lines? If you'd put an additional figure command just before the hist(...) line you'd also be able to see the histogram.
The line
%0.003 = 3 ms;
doesn't do anything as is a comment

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]