MATLAB: What is wrong with code for looplooploopsMATLABmatrixmatrix manipulation I want a matrix as follows: n = 12b = zeros(n,n)b(1,:) = 1:nb(2,:) = 1:n.^2etc... How can I express that in a loop form? Best Answer for i=1:n b(i,:)=(1:n).^i;end Related SolutionsMATLAB: Save part of an array Hello Sonarine,Try for this.. A = [1:10000]; for i = 1:length(A)/20 B(i,:) = A((i-1)*20+1:i*20); endto check the output.. B(1,:) B(2,:)So on.. MATLAB: How to save each value for this loop I am not certain what you want.Try this:N = 5;A = 0;w = 1; %where omega is equals to 2pi/tau and tau is equals to 2pia_0 = pi/4;for i = 1:1:N a_n = 2*(-1)^N-1 / pi*N^2; A(i+1) = A(i) + a_n;end Related QuestionHow to store values form a loop in a vectorHow to find cell position in a column based on sum of column.How can generalize severel “For loop”Matrix and For
Best Answer