How move elements of a matrix from lower to higher values with limit?

Hellow everyone,
I need help to solve this problem here. Suppose this cuve is plotted between D (y axis) and S (x axis). The average value of S in the shown interval is 0.5 and are varies in between 0.3 and 0.9. I want to shift average value upto all the values in between 0.9 and 1 (not straight line). How I can do it in such a way that already higher values move less and lower moves more and they become in between 0.9 and 1. 1 is maximum limit.

 採用された回答

Image Analyst
Image Analyst 2021 年 12 月 9 日

0 投票

You need to rescale your S values from 0.3 - 0.9 (or whatever it actually is) to 0.9 to 1.0.
S = rescale(S, 0.9, 1.0);
This will put the old min value at a new min value of 0.9, and the old max value at a new max value of 1.0. In between it's a linear stretch, which I assume you want. If you want it non-linear it will be more complicated and I don't see any reason to do it like that anyway.

7 件のコメント

Nisar Ahmed
Nisar Ahmed 2021 年 12 月 9 日
@Image Analyst, thank for the coments, but how I can put limit on Y axis, I cut lower part which shown here. There is also some part above this curve. I need irregular patern (not linear) the same as in the initial curve but with some higher values between 0.9 - 1.
Image Analyst
Image Analyst 2021 年 12 月 9 日
How are you defining the pattern to shift the curve? Of course adding an irregular pattern to the x values will change the shape of the curve, not merely shift it to the right.
To set the limits of the Y axis you can use ylim():
ylim([2000, 2050]); % Y axis shown only between 2000 and 2050, other values will be unseen.
Nisar Ahmed
Nisar Ahmed 2021 年 12 月 9 日
I ant same pattern, higher values need be higher and lower will remains lower. However, for lower value say 0.5 need to move to go up 0.9 while higher value say 0.8 needs to move less and upto say 0.98.
Image Analyst
Image Analyst 2021 年 12 月 9 日
Did you try it? Because that's what it does. If you don't agree, attach your data and I'll try it with your data. And tell me what value did not end up at the desired value.
Nisar Ahmed
Nisar Ahmed 2021 年 12 月 10 日
Dear @Image Analyst I tried S = rescale(S, 0.9, 1.0); and it is working. But I want rescle some part of curve say y axis limit (1980 - 2025). How I can include yaxis limit in S = rescale(S, 0.9, 1.0); in such a way it only rescale lower part and keep upper part same. and after rescalling I want full curve (rescaled and not rescaled).
Thanks for all reply
Nisar Ahmed
Nisar Ahmed 2021 年 12 月 10 日
@Image Analyst I find the solution as sw(VD>1970) = rescale(sw(VD>1970), 0.95, 1.0); but how I can do if I need to put a limit as VD from 1917 to 1970 I mean in between 1917 - 1970, rather than VD>1970?
Image Analyst
Image Analyst 2021 年 12 月 10 日
Just use masking:
indexesToChange = (VD > 1917) & (VD < 1970);
sw(indexesToChange) = rescale(sw(indexesToChange), 0.95, 1.0);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Axes Appearance についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by