필터 지우기
필터 지우기

converting a vector to matrix

조회 수: 1 (최근 30일)
Charlotte Reed
Charlotte Reed 2020년 2월 27일
댓글: Walter Roberson 2020년 2월 28일
I'm doing practice questions, and I am stuck. If the vector is x=[9,4,0,7] and i want to create a Matrix with 4 rows (the original vector, the recipricol, the factorial of the originals using my own code i already wrote, and the factorial using matlab's factorial function) while also putting ruler lines above and below the outputs. How the heck does one do this?

채택된 답변

David Hill
David Hill 2020년 2월 28일
Not sure if this is what you are after, but it could be a starting point. Not sure what you mean by ruler lines above and below.
y=[x;1./x;factorial(x)];
  댓글 수: 10
Charlotte Reed
Charlotte Reed 2020년 2월 28일
thanks so much!! and for the
fprintf('------------- ------------- ----------- ------------\n')
fprintf('M\n')
fprintf('------------- ------------- ----------- ------------\n')
?
Thanks so much for the help, pretty new to it and having trouble.
Walter Roberson
Walter Roberson 2020년 2월 28일
fprintf('------------- ------------- ----------- ------------\n')
fprintf('%13.5f %13.5f %13.5f %13.5f\n', M');
fprintf('------------- ------------- ----------- ------------\n')
The choice of 13.5f is speculation on my part: you will want to play around with the .5 part.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by