cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to limit the size of a matrix in Mathcad

SOLVED
A_B
Newbie

How to limit the size of a matrix in Mathcad

Hello,

I am trying to limit the size of a 10x10 matrix depending on a given variable, for example (n). The 10x10 matrix is the basic matrix with all numbers in it.

(n) is going to be any number from 0 to 10. for instance, if I put n=6, the matrix is going to be 6x6 with its numbers coming from the 10x10 matrix.

To be more clear, if I have this matrix which is 10x10 ( the basic matrix) with all its variables are given:

K=[ k1+k2 -k2 0 0 0 0 0 0 0 0 ;

-k2 k2+k3 -k3 0 0 0 0 0 0 0 ;

0 -k3 k3+k4 -k4 0 0 0 0 0 0 ;

0 0 -k4 k4+k5 -k5 0 0 0 0 0 ;

0 0 0 -k5 k5+k6 -k6 0 0 0 0 ;

0 0 0 0 -k6 k6+k7 -k7 0 0 0 ;

0 0 0 0 0 -k7 k7+k8 -k8 0 0 ;

0 0 0 0 0 0 -k8 k8+k9 -k9 0 ;

0 0 0 0 0 0 0 -k9 k9+k10 -k10 ;

0 0 0 0 0 0 0 0 -k10 k10]

If I put n=3, the matrix will be 3x3 coming from the 10x10 matrix (the basic matrix):

K=[ k1+k2 -k2 0 ;

-k2 k2+k3 -k3

0 -k3 k3+k4]

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to limit the size of a matrix in Mathcad

extract(M,n):=submatrix(M,0,n-1,0,n-1)

View solution in original post

2 REPLIES 2

Re: How to limit the size of a matrix in Mathcad

extract(M,n):=submatrix(M,0,n-1,0,n-1)

View solution in original post

Re: How to limit the size of a matrix in Mathcad

That works.

Thanks alot.

Announcements