简体   繁体   中英

How to project a signal into a new range?

I have two signals with very different amplitude ranges:

sig1 = np.array([1.00e-6, 1.02e-6, 1.01e-6, 0.98e-6, 1.00e-6])
sig2 = np.array([100, 101, 103, 100, 98])

My goal is to project sig1 into the basis (or range of amplitudes) of sig2 so that I can plot them with a unified axis instead of dual y -axes.

My approach is to first normalize sig1 into [0,1]:

sig1_norm = (sig1 - sig1.min()) / (sig1.max() - sig1.min())

and then undo the normalization using the range of sig2 :

Sig1InSig2Range = sig1_norm * (sig2.max() - sig2.min()) + sig2.min()

Visually, the result looks good but I want to ensure that I'm not violating anything mathematically by doing this. I also want to be sure that I'm not distorting sig1 , and that I preserve its shape.

Is my approach valid, or is there a more appropriate way of accomplishing this?

Your approach is valid since the distortion is equal to all values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM