MATLAB Answers

Help with matrix creation

1 view (last 30 days)
Megan Caston
Megan Caston on 2 Feb 2020
Answered: Pavel Osipov on 2 Feb 2020
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!!!

  0 Comments

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 2 Feb 2020
A = [ones(size(j));z;z.^2;z.^3].'

  0 Comments

Sign in to comment.


Pavel Osipov
Pavel Osipov on 2 Feb 2020
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

  0 Comments

Sign in to comment.

Tags