I have used the below technique that I get help on it in previous post to generate the matrix P[m*6] and is so efficient, and have used the generated values to compute another function recursively A[m*100]. What I need now is to use the all possible values and the computed function in real simulation, to do this I need an efficient method to search fast within the all possible values ( which is a huge matrix i.e m is very big) to match real time values with some approximation boundaries and when I get the nearest match I just want to know the index of the match so I can get the other value A(m*100), in this case i need the index m ( row) . For example lets say that I am searching for [ 0.1122 0.2345 0.5876 0. 8977 0.3674 0.3756] and the the nearest value in matrix P is [0.111 0.232 0.588 0.889 0.368 0.376] , when match is done I can get the index to get value of A, remember the P matrix
is very large i.e m=15625000000. Any
suggestions I would be appreciated and I would like to explain any matter that is not clear in this post. Thanks
_____________________________________________________________________
my previous post
_______________________________________________________
Thread Subject: Need help from matlab experts
Subject: Need help from matlab experts
From: Raied
Date: 1 May, 2010 10:27:05
Message: 1 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
Hi every body,
I need some help in matlab, my simulation program should make some calculations on a huge no. of random data, in fact these data have some bounds, so we figured out to compute all possible values in the range of data then save the computed values to be used in the original simulation when it is needed. To be more specific lets say we have 6 variables in which each variable change from 01 with step .02, I need to compute all possible values between these variables and for each set of the six variables I have some calculations and another value is computed, more over the whole operation repeated say 50 times in recursive computation to compute the value for each set of variables lets say for all times. I hope I made the general idea clear and I would like to explain if anything is not clear. I need some help wt is the best way to do this to gain execution time and wt is the best way to
generate the matrix off all possible values since when using for loops it took too long time. I would like to try generating the matrix of all possible values by mean of vectors, any suggestion on this would help. thanks
Subject: Need help from matlab experts
From: us
Date: 1 May, 2010 12:17:21
Message: 2 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
"Raied " <rodytc@yaoo.com> wrote in message <hrgvlp$qfc$1@fred.mathworks.com>...
> Hi every body,
> I need some help in matlab, my simulation program should make some calculations on a huge no. of random data, in fact these data have some bounds, so we figured out to compute all possible values in the range of data then save the computed values to be used in the original simulation when it is needed. To be more specific lets say we have 6 variables in which each variable change from 01 with step .02, I need to compute all possible values between these variables and for each set of the six variables I have some calculations and another value is computed, more over the whole operation repeated say 50 times in recursive computation to compute the value for each set of variables lets say for all times. I hope I made the general idea clear and I would like to explain if anything is not clear. I need some help wt is the best way to do this to gain execution time and wt is the best way
to
> generate the matrix off all possible values since when using for loops it took too long time. I would like to try generating the matrix of all possible values by mean of vectors, any suggestion on this would help. thanks
one of the possible solutions
% the data
rng=0:.5:1; % < your range...
nv=3; % < your # of vars...
% the engine
arg=repmat({rng},1,nv);
n=numel(arg);
x=cell(n,1);
[x{1:n,1}]=ndgrid(arg{end:1:1});
p=reshape(cat(n+1,x{:}),[],n);
p=p(:,end:1:1);
% the result
disp(p);
%{
0 0 0
0 0 0.5
0 0 1
0 0.5 0
0 0.5 0.5
0 0.5 1
0 1 0
0 1 0.5
0 1 1
0.5 0 0
0.5 0 0.5
0.5 0 1
0.5 0.5 0
0.5 0.5 0.5
0.5 0.5 1
0.5 1 0
0.5 1 0.5
0.5 1 1
1 0 0
1 0 0.5
1 0 1
1 0.5 0
1 0.5 0.5
1 0.5 1
1 1 0
1 1 0.5
1 1 1
%}
us
Subject: Need help from matlab experts
From: Raied
Date: 1 May, 2010 17:25:09
Message: 3 of 4
Reply to this message
Add author to My Watch List
View original format
Flag as spam
"us " <us@neurol.unizh.ch> wrote in message <hrh64h$kcr$1@fred.mathworks.com>...
> "Raied " <rodytc@yaoo.com> wrote in message <hrgvlp$qfc$1@fred.mathworks.com>...
> > Hi every body,
> > I need some help in matlab, my simulation program should make some calculations on a huge no. of random data, in fact these data have some bounds, so we figured out to compute all possible values in the range of data then save the computed values to be used in the original simulation when it is needed. To be more specific lets say we have 6 variables in which each variable change from 01 with step .02, I need to compute all possible values between these variables and for each set of the six variables I have some calculations and another value is computed, more over the whole operation repeated say 50 times in recursive computation to compute the value for each set of variables lets say for all times. I hope I made the general idea clear and I would like to explain if anything is not clear. I need some help wt is the best way to do this to gain execution time and wt is the best
way
> to
> > generate the matrix off all possible values since when using for loops it took too long time. I would like to try generating the matrix of all possible values by mean of vectors, any suggestion on this would help. thanks
>
> one of the possible solutions
>
> % the data
> rng=0:.5:1; % < your range...
> nv=3; % < your # of vars...
> % the engine
> arg=repmat({rng},1,nv);
> n=numel(arg);
> x=cell(n,1);
> [x{1:n,1}]=ndgrid(arg{end:1:1});
> p=reshape(cat(n+1,x{:}),[],n);
> p=p(:,end:1:1);
> % the result
> disp(p);
> %{
> 0 0 0
> 0 0 0.5
> 0 0 1
> 0 0.5 0
> 0 0.5 0.5
> 0 0.5 1
> 0 1 0
> 0 1 0.5
> 0 1 1
> 0.5 0 0
> 0.5 0 0.5
> 0.5 0 1
> 0.5 0.5 0
> 0.5 0.5 0.5
> 0.5 0.5 1
> 0.5 1 0
> 0.5 1 0.5
> 0.5 1 1
> 1 0 0
> 1 0 0.5
> 1 0 1
> 1 0.5 0
> 1 0.5 0.5
> 1 0.5 1
> 1 1 0
> 1 1 0.5
> 1 1 1
> %}
>
> us
Thanks a lot, the code just worked perfectly generating the data , I will use it in my simulation and if any other difficulty exists dealing with vector data , I will ask you later, Thanks again
_____________________________________________________________________
____________________________________________________________________
