# Linearly space matrix

Note

The file submission referenced in this post is no longer available on File Exchange.

This week’s guest pick of the week comes from Brett Shoelson of CSSM fame and one of the newer Language of Technical Computing Applications Engineers here at The Mathworks. Applications Engineers present a lot of live seminars, maybe you can meet Brett at his next event and ask him some really tough questions!

Let’s say that you wanted to create a linearly spaced vector of elements ranging from scalar x1 to scalar x2; MATLAB’s own linspace.m function was built for that purpose, and makes it a trivial problem. But what if instead you wanted to step from vector X1 to (same-sized) vector X2 in a given number of steps? Or more dauntingly, consider the task of uniformly incrementing the elements of N-dimensional matrix M1 to the equal-sized matrix M2 in a specified number of steps. Certainly there are several ways to approach the problem, but none is particularly easy. Until, that is, you download Duane Hanselman’s linspacen, which, with some very nice code, makes short work of the problem. Duane has also provided the functionality to step logarithmically in N dimensions, expanding the functionality of MATLAB’s logspace function. The pair, linspacen and logspacen, together comprise this week’s Pick of the Week.

|

### 댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.