use rescale with matrix
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
hi,i want to normalize matrix using interval -1 and 1
load('matlab_E');
B=rescale(E,1,-1);
Error using rescale>preprocessInputs (line 90)
Lower bound argument must be less than or equal to the upper bound argument.
Lower bound argument must be less than or equal to the upper bound argument.
Error in rescale (line 36)
[A, a, b, inputMin, inputMax] = preprocessInputs(A, varargin{:});
채택된 답변
Steven Lord
2025년 5월 9일
0 개 추천
댓글 수: 8
shamal
2025년 5월 9일
excuse me..it's possible to reconvert normalize series in the original series?
I'm not sure I understand what you're asking. Are you asking if you can take the output of rescale and reverse the scaling to obtain the original array again? That would depend on whether or not you have some additional information about your original array.
x1 = [1 2 3 4 5]
x1 = 1×5
1 2 3 4 5
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
x2 = x1 + 100
x2 = 1×5
101 102 103 104 105
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
R1 = rescale(x1, 0, 1)
R1 = 1×5
0 0.2500 0.5000 0.7500 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
R2 = rescale(x2, 0, 1)
R2 = 1×5
0 0.2500 0.5000 0.7500 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
isequal(R1, R2)
ans = logical
1
Without any additional information, if I gave you R1 (which is the same as R2), how could you tell me if the original array was x1 or x2?
example: (look pics)
I need to calculate boolinger band (stdev) in series
to do this i want do normalize series and after i calculate boolinger band
Now i want to plot the band stdev but it's normalize, then i must to convert series normalize in series not normalize
in imagine.png you see original series and the boolinger Not nornalized
if i normalize series and calculate boolinger band using normalized i see a band in interval -1 1 and i don't plot it..
i must to reconvert to plot it
you write : "Without any additional information, if I gave you R1 (which is the same as R2), how could you tell me if the original array was x1 or x2?"
I 've information about the max and min of series and i can use it to reconvert series
Okay, so you want to rescale other data using the same scaling factors that were used on the original data? In that case perhaps the normalize function is what you want. Let's say I normalize a vector to cover the range [0, 1] and I ask for three outputs.
x = 10:15;
[y1, c, s] = normalize(x, "range")
y1 = 1×6
0 0.2000 0.4000 0.6000 0.8000 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
c = 10
s = 5
Now if I normalize one of the data points in x (without the rest) and use the outputs from the first normalize call I ought to get essentially the same value as the element in y1 corresponding to that data point in x.
y2 = normalize(x(4), "center", c, "scale", s) % ought to be essentially y1(4)
y2 = 0.6000
difference = y1(4)-y2 % essentially 0
difference = 1.1102e-16
ok thank you but if i've this serie normalize "0 0,2000 0,4000 0,6000 0,8000 1,0000"
i want to get :"10 11 12 13 14 15"
it's possibile? I didn't see this in your steps
Voss
2025년 5월 10일
@Luca Re: Given:
have = [0 0.2 0.4 0.6 0.8 1];
min_to_get = 10;
max_to_get = 15;
Here's the math that does what you want:
min_have = min(have);
max_have = max(have);
to_get = (have-min_have)./(max_have-min_have).*(max_to_get-min_to_get)+min_to_get
to_get = 1×6
10 11 12 13 14 15
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Or, here's the MATLAB function call to do it:
to_get = rescale(have,min_to_get,max_to_get)
to_get = 1×6
10 11 12 13 14 15
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
shamal
2025년 5월 10일
Thank you
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Time Series에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
