How to create row vector inside row vector

I want to make this kind of row vector:
I have p=(p^(0),p^(1),p^(2),...) %^(i) is not rank, its just index. p^(i)
p^(i)=(p_(4i)^(i),p_(4i+1)^(i),p_(4i+2)^(i),p_(4i+3)^(i)), where
p_j^(i)=(p_(j,0,1)^(i),p_(j,0,2)^(i),...,p_(j,0,N)^(i),
p_(j,1,1)^(i),p_(j,1,2)^(i),...,p_(j,1,N)^(i),...,
p_(j,M,1)^(i),p_(j,M,2)^(i),...,p_(j,M,N)^(i)) i,j>=0 , 4i<=j<=4i+3
for example if i have N=3 M=4, i get p^(0)=(p_(0)^(0),p_(1)^(0),p_(2)^(0),p_(3)^(0))
inside p_(0)^(0)=(p_(0,0,1)^(0),p_(0,0,2)^(0),p_(0,0,3)^(0),
p_(0,1,1)^(0),p_(0,1,2)^(0),p_(0,1,3)^(0),
p_(0,2,1)^(0),p_(0,2,2)^(0),p_(0,2,3)^(0),
p_(0,3,1)^(0),p_(0,3,2)^(0),p_(0,3,3)^(0)),
p_(0,4,1)^(0),p_(0,4,2)^(0),p_(0,4,3)^(0)).
I have this code,
p=sym('p',[1 N]) %but it can only get 1 row vector of N column.

댓글 수: 5

I don't understand your nomenclature. Are these all different arrays : p, p_, and p_j ???
p and p_j are 1-D vectors since they take one index but p_ is a 3-D array since it's taking 3 indexes. Why?
Anything raised to the zero power is 1 so (p_(0)^(0),p_(1)^(0),p_(2)^(0),p_(3)^(0)) = [1,1,1,1].
Can you give an actual numerical example.
DoinK
DoinK 2022년 11월 14일
I have 3-D matrix and open it to 2-D matrix,
I need to make the row vector based on 3-D matrix, so it is p_j,k,l j>=0, 0<=k<=M, 1<=l<=N
i have to do it like that because later i need to double summation on that p_i,j,k
^(i)/^(0) is not raised to the zero power, its just index 0, and so on.
Jan
Jan 2022년 11월 14일
If "^(i)" means an index, why don't you just use an index? Inventing a new syntax is confusing only.
"I need to make the row vector based on 3-D matrix" - so actually you want to create a 3D array.
The follow-up question does not increase the clarity also: https://www.mathworks.com/matlabcentral/answers/1850328-how-to-create-row-vector
DoinK
DoinK 2022년 11월 14일
i give a matrix and more explanation at here https://www.mathworks.com/matlabcentral/answers/1850328-how-to-create-row-vector
Jan
Jan 2022년 11월 14일
@Eliana Utomo: As I've written already, the other question is not clear also.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2022년 11월 13일

댓글:

Jan
2022년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by