10x10 Matrix

조회 수: 20 (최근 30일)
Gulnabi sadat
Gulnabi sadat 2021년 4월 18일
답변: Image Analyst 2025년 4월 13일
Create a 10x10 matrix with random numbers between 0 and 10. Now, make all elements in the first row
and first column equal to 1.

답변 (2개)

David Fletcher
David Fletcher 2021년 4월 18일
a=ones(10);
a(2:end,2:end)=randi([0 10],9)
  댓글 수: 3
AFARIEBOR
AFARIEBOR 2025년 4월 12일

How do I solve the matrix created

Image Analyst
Image Analyst 2025년 4월 12일
@AFARIEBOR, exactly what does that mean? A matrix is just an array of numbers. Exactly what does "solve" mean to you? Explain it in a new question, after you read this: TUTORIAL: How to ask a question (on Answers) and get a fast answer
To learn other fundamental concepts, invest 2 hours of your time here:

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


Image Analyst
Image Analyst 2025년 4월 13일
Alternatively (since you already have a solution to your homework problem from the other Answer) you can do
m = 10 * rand(10); % Floating point/fractional numbers between 0 and 10
m(1,:) = 1; % Set first (top) row to all 1's.
m(:, 1) = 1 % Set first (left) column to all 1's
m = 10×10
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 6.8070 3.1112 4.9140 9.1819 6.3194 0.0341 7.7900 0.1539 0.0860 1.0000 6.5445 9.9021 5.2543 2.5586 2.9030 6.2208 2.3277 1.1559 3.6616 1.0000 5.9999 7.2022 8.2458 3.9075 9.0335 9.7657 4.8203 8.3590 5.9221 1.0000 1.0735 7.3094 3.7993 1.8270 3.0140 9.2632 0.3387 1.3490 5.2056 1.0000 6.5463 8.6247 8.1245 9.8701 4.2858 3.2489 6.0396 2.5677 9.2224 1.0000 7.5483 5.4154 8.8915 0.2369 4.4961 9.7232 7.8814 9.4859 7.7926 1.0000 0.4361 7.9013 5.6659 3.1768 6.4170 1.7165 0.0353 0.2055 3.0151 1.0000 8.4577 3.5940 1.1995 1.1773 1.9292 6.1663 4.8020 5.8406 8.6661 1.0000 3.5766 2.0541 7.9196 2.9416 1.9030 1.1748 8.7392 6.0792 7.5713
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
To learn other fundamental concepts, invest 2 hours of your time here:

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by