use rescale with matrix
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 日
8 件のコメント
shamal
2025 年 5 月 9 日
excuse me..it's possible to reconvert normalize series in the original series?
Steven Lord
2025 年 5 月 9 日
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
Steven Lord
2025 年 5 月 9 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
