Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
>> tau = 6:100; h = [2,3,4];
>> X = bsxfun(@rdivide,tau,h(:));
>> Y = X(rem(X,1)==0);
thank you

Antworten (1)

Geoff Hayes
Geoff Hayes am 22 Mär. 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.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by