How to fit data to another data

I have two 1000000x1 vectors of data (data1 and data2). data1 is normalized. Now I need to scale data2 to data1.

2 件のコメント

lazymatlab
lazymatlab 2020 年 4 月 8 日
You need to be more specific. What do you mean by 'scale'? Do you want to multiply a scalar to data2? Or each element of data2 needs to scale individually?
Alina Li
Alina Li 2020 年 4 月 8 日
This is a more of a general question. I want to scale each element of data2 to data1. So the size of plot of data1 (i.e. the values in vector of data1) is proportional to data2 vector/plot. I have a variety of different data I need to work with. So my question is not case specific.

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

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 8 日

0 投票

You can try something like this
x % the normalized array
y % the unnormalized array
y_norm = normalize(y, 'range')*(max(x)-min(x))+min(x)
It will make the min() and max() values of x and y same.

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

製品

リリース

R2019a

質問済み:

2020 年 4 月 8 日

回答済み:

2020 年 4 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by