Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

i wanna save the tau and h values in each iteration for which y values are calculated

1 visualización (últimos 30 días)
>> tau = 6:100; h = [2,3,4];
>> X = bsxfun(@rdivide,tau,h(:));
>> Y = X(rem(X,1)==0);
thank you

Respuestas (1)

Geoff Hayes
Geoff Hayes el 22 de Mzo. de 2015
Arunachalam - try using find to determine those rows and columns of X whose remainder (when divided by one) is zero. Something like
[rowIdcs, colIdcs] = find(rem(X,1)==0);
The rowIdcs would tell you the h and the colIdcs would tell you the tau. For example, if I run the above line, the first handful of row indices and column indices are
>> rowIdcs(1:5)
ans =
1
2
1
3
2
colIdcs(1:5)
ans =
1
1
3
3
4
The first two elements of colIdcs are 1 which corresponds to tau(1) (i.e. 6). The first two elements of rowIdcs are 1 and 2 which corresponds to 2 and 3 respectively. And this makes sense since 6 is evenly divisible by 2 and 3 but not by 4.

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by