How to create a Matrix

What should i write in the code to create this matrix

1 个评论

you can write this in MATLAB like:
A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
I would suggest you to take MATLAB Fundamentals course, its free

请先登录,再进行评论。

回答(6 个)

A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
I would recommend you have a look at the Matlab Onramp course. It will give you a good grounding in the basics of Matlab

3 个评论

The issue is that i have a certain code with missing parts
Ahh ok - didn't look at the picture. Somebody else has answered anyway.

请先登录,再进行评论。

A = reshape(flip(11:22),4,[])
A = reshape(22:-1:11,4,[])

4 个评论

so to reshape this
v = [22:-1:10]
v =
22 21 20 19 18 17 16 15 14 13 12 11 10
into this
i should write this code
A = reshape(flip(11:22),4,[])
and what should i do now?
v = 22:-1:11;
A = reshape(v,4,[]);
or
v = 22:-1:10;
n = numel(v);
A = reshape(v(1:n - mod(n,4)),4,[])

请先登录,再进行评论。

fyp matlab
fyp matlab 2021-5-14

0 个投票

Just write this to create this Matrix
A=[22 18 14; 21 17 13; 20 16 12; 19 15 11]
Kartikay Sapra
Kartikay Sapra 2021-5-19

0 个投票

You can use:
A = reshape(22:-1:11, 4, 3)

类别

帮助中心File Exchange 中查找有关 Matrices and Arrays 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by