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

조회 수: 1 (최근 30일)
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일
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월 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개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by