Create the following Matrix typing one command

조회 수: 27 (최근 30일)
Jens
Jens 2021년 1월 15일
답변: Athul Prakash 2021년 1월 18일
Hello,
for an exam i need to solve the following question:
Create the following matrix E by typing one command (i.e. do not type individual elements explicitly):
E =
How is it possible? Im thankful for your help.

답변 (1개)

Athul Prakash
Athul Prakash 2021년 1월 18일
Hi Jens,
In MATLAB for entering matrix values, commas and spaces can be used (interchangeably) to separate values left to right (i.e. in the same row) and a semicolon can be used to separate the end of a row of values from the start of the next row.
For example:
a = [1 2 3, 4, 5; 11, 12, 13 14, 15] % 1 to 5 appear in the first (top) row and 11 to 15 in the second row.
% You should enter the same number of elements in each row, otherwise you'd get an error.
If you're new to using MATLAB, I would recommend the 'MATLAB OnRamp' course linked below. It covers the fundamentals of MATLAB well and would help new users a lot in picking up MATLAB.
Hope it helps!

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by