Matrix for two variables

I have 2 variables, a and b with respective values 1.123456789 and 3.123456789. Please help me to generate the matrix for the possible combination based on the formula 2^n, n = integer number 1 to 50. E.g if n=3, the output should be a matrix of 8 by 3:
1.123456789 1.123456789 1.123456789
1.123456789 1.123456789 3.123456789
1.123456789 3.123456789 1.123456789
1.123456789 3.123456789 3.123456789
3.123456789 1.123456789 1.123456789
3.123456789 1.123456789 3.123456789
3.123456789 3.123456789 1.123456789
3.123456789 3.123456789 3.123456789

댓글 수: 1

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 12일
편집: Azzi Abdelmalek 2012년 10월 12일
what is the link between a, b and 2^n. Combinaison of what?

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 10월 12일
편집: Andrei Bobrov 2012년 10월 12일

0 개 추천

use function ff2n from Statistics Toolbox
n = 3;
a = [1.123456789 , 3.123456789];
ii = ff2n(n)+1;
out = a(ii);

댓글 수: 1

Enfa White
Enfa White 2012년 10월 15일
The a and b values generated by ff2n is a matrix of 8 by 3 (for n=3). How can I use these a and b as the input values for the following function:
function my_func = out(~,~)
x = (1+sin(5*a)-(1/sqrt(8*(sin(a))))) y = (1+sin(5*b)+(1/sqrt(8*(sin(b)))))
out=(2*(x+y))/2+x

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by