Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8637039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:22:47+00:00 2026-06-12T10:22:47+00:00

Say I have a matrix A with 3 columns c1 , c2 and c3

  • 0

Say I have a matrix A with 3 columns c1, c2 and c3.

1 2 9
3 0 7
3 1 4

And I want a new matrix of dimension (3x3n) in which the first column is c1, the second column is c1^2, the n column is c1^n, the n+1 column is c2, the n+2 column is c2^2 and so on. Is there a quickly way to do this in MATLAB?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:22:48+00:00Added an answer on June 12, 2026 at 10:22 am

    Combining PERMUTE, BSXFUN, and RESHAPE, you can do this quite easily such that it works for any size of A. I have separated the instructions for clarity, you can combine them into one line if you want.

    n = 2;
    A = [1 2 9; 3 0 7; 3 1 4];
    [r,c] = size(A);
    
    %# reshape A into a r-by-1-by-c array
    A = permute(A,[1 3 2]);
    
    %# create a r-by-n-by-c array with the powers
    A = bsxfun(@power,A,1:n);
    
    %# reshape such that we get a r-by-n*c array
    A = reshape(A,r,[])
    
    A =
    
         1     1     2     4     9    81
         3     9     0     0     7    49
         3     9     1     1     4    16
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a matrix ( MxN ) which has its rows and columns
Say you have a 2D matrix,Is there a particular algorithm or way to do
Let's say I have a matrix x which contains 10 rows and 2 columns.
I have a 2D matrix, say M=zeros(10,10); I have another column matrix, V=[1;2;3;4;5;6;5;4;3;2]; I
I've got a matrix (mat1), say 100 rows and 100 columns; I want to
Let's say I have a 100x100 matrix A, and I want to get another
Let's say I have a matrix of values that I want to populate, that
Say I have a matrix with 3 columns: c1 , c2 , c3 ,
I have a matrix variable in R, say k. I want to write it
I have a R object say: mat <- matrix(1:100,nrow=20) I want to send this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.