Do you have a question? Post it now! No Registration Necessary
- Subject
- Posted on
- verifying UNIFORM using matlab
- 03-03-2008
posted on
March 3, 2008, 9:15 pm
March 3, 2008, 9:15 pm
I have written a process to generate random numbers using UNIFORM. I
was trying to check the results using "rand" in matlab. How do i
initialise the seed values of both these functions to the same value.
I see that the random numbers generated by UNIFORM are different
compared to rand when the seed values are left uninitialised.
What do I need to change so that I get same output from both programs.
Thanks
was trying to check the results using "rand" in matlab. How do i
initialise the seed values of both these functions to the same value.
I see that the random numbers generated by UNIFORM are different
compared to rand when the seed values are left uninitialised.
What do I need to change so that I get same output from both programs.
Thanks
Re: verifying UNIFORM using matlab
Uninitilised positives (the seeds in this case) will take a value of 1
when they are put into the uniform function. Unitialised types when
used will take type'low as their value
positive'low = 1
std_logic'low = 'u'
etc.
so both of your first calls to uniform are seeding it with two 1s.
I dont know how the seeding works in matlab. It may not even use
positives, but the entire integer range. it is common in C to seed the
random number generator with the system time. Does matlab do something
similar? The C random function only has 1 seed, whereas uniform takes
2.
Re: verifying UNIFORM using matlab
I am not sure how the rand function in MATLAB works. I tried to search
if the code of the function was described anywhere but couldnt find.
I dont know if we can get MATLAB to generate results as UNIFORM does.
As you said, uniform has 2 seeds while rand has 1.
If anyone has an idea on how this can be done, please post your
comment.
Re: verifying UNIFORM using matlab
The goal is to check that the VHDL code generates results similar to
MATLAB . I have written the outputs of both in seperate text files. I
am not able to initialise the rand function to generate results
similar to MATLAB and vice versa. Called MATLAB today to get some more
information on how they have developed the rand function. They said
that this information is not available to the public.
I think one of the ways to do this would be, generating a pdf function
for both cases and showing that their random distriution is similar.
If any of you have other ideas please post them.
Re: verifying UNIFORM using matlab
I
value.
programs.
1
the
something
Sounds like you have an ill-posed question here.
Mathworks won't tell you how it got it's pseudo-random stream...call
it rand(i), where rand(0)
is the seed.(In fact, you don't even know if there is a single seed or
any seed for that matter!)
You have created a pseudo-random stream fpga_rand(i), where the seed
is fpga_rand(0).
You are going to have to be satisfied with using statistical tests to
verify that
your function fpga_rand passes as many of the tests as you need, or at
least as many as the
matlab rand function passes. Look up http://en.wikipedia.org/wiki/Diehard_tests
alan
Site Timeline
- » reconfiguration of virtex 2 pro
- — Next thread in » Field-Programmable Gate Arrays
- » "Use Multi-level Logic Optimization" -- Advanced Fitting option
- — Previous thread in » Field-Programmable Gate Arrays
- » Multi-FPGA Interconnection: latest techniques
- — Newest thread in » Field-Programmable Gate Arrays
- » Multi-FPGA Interconnection: latest techniques
- — The site's Newest Thread. Posted in » Field-Programmable Gate Arrays