Create non-linear vector in Matlab
显示 更早的评论
I would like to (automatically) create a vector that has three sections, where the middle section has a higher "density" than the two surrounding sections.
Example: A=[0, 1, 2, 3, 4, 4.2, 4.4, 4.6, 4.8, 5, 6, 7, 8, 9, 10]
The spacing within each of the three sections is lin-spaced.
I am looking for a function where I can state the width of the three sections and the start and end value of each section.
Additionally, I need a 2nd vector that gives me the mid-point of every subinterval, and a 3rd vector that gives the distance from one mid-point to next.
(I do need this vector for analysing a "hot-spot" in a numercial analysis.)
Can anybody help me?
采纳的回答
更多回答(2 个)
Image Analyst
2014-12-25
0 个投票
If you created the vector with linspace() then you know how many elements are in each section - it's the third input argument of linspace().
1 个评论
Image Analyst
2014-12-25
Wait a minute. Exactly what do you mean by "state"? Initially I thought you wanted the function to "state the width of the three sections and the start and end value of each section", in other words, I thought that you'd pass in the array and you wanted the function to report/state/notify/tell you how many elements were in each of the 3 subintervals, like you wanted it to determine it for you. But now I think another interpretation would be that state means to pass in as input arguments, like you pass in starting and ending values, and number of elements, for each of the 3 segments, and you want the function to build the array and return it to you as an output argument. So which is it? What does "state" mean to you?
Tobi12
2014-12-26
0 个投票
1 个评论
Star Strider
2014-12-26
My pleasure!
The most sincere expression of appreciation here on Matlab Answers is to Accept the Answer that most closely solves your problem.
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!