필터 지우기
필터 지우기

i want factorial matrix

조회 수: 3 (최근 30일)
Emre Metin
Emre Metin 2020년 5월 22일
댓글: Image Analyst 2020년 5월 22일
i want to create a matrix which includes all numbers from 1 to n. n is given by user so i don't know n. In other words a matrix which i want to create must include n! numbers. n, n-1, n-2... n-(-n-1).

채택된 답변

Image Analyst
Image Analyst 2020년 5월 22일
편집: Image Analyst 2020년 5월 22일
Did you look up factorial in the help?
>> n = input('Enter n : ')
Enter n : 8
n =
8
>> output = factorial(n : -1 : 1)
output =
40320 5040 720 120 24 6 2 1
  댓글 수: 3
Emre Metin
Emre Metin 2020년 5월 22일
but this is okey i understood the answer thank you so much :D
Image Analyst
Image Analyst 2020년 5월 22일
I don't see how [8 7 6 5 4 3 2 1] has anything at all to do with factorial. If you want that you can simply do
output = n : -1 : 1;
but that's just super basic MATLAB stuff.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by