Help with matrix creation

조회 수: 2 (최근 30일)
Megan Caston
Megan Caston 2020년 2월 2일
답변: Pavel Osipov 2020년 2월 2일
I am trying to create a matrix based on A = [1,z(j),z(j)^2,z(j)^3] where j = 1:41 and z(j) = (j-1)/10. I got the for loop working for creating the vector z(j) but I cannot get matlab to create the 41X4 A matrix that I need. Help me please!!!

답변 (2개)

Walter Roberson
Walter Roberson 2020년 2월 2일
A = [ones(size(j));z;z.^2;z.^3].'

Pavel Osipov
Pavel Osipov 2020년 2월 2일
Hi? Megan Caston. I'm think, it's may be
>> j = 1:41; z(j) = (j-1)/10;
>> lenZ=length(z);
>> AA=[ones(lenZ,1), z',(z.^2)',(z.^3)'];
z.JPG
I'm hope, it's usefool for you.A.JPG

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by