How do I align and subtract two data sets?

9 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 8 月 1 日
編集済み: MathWorks Support Team 2024 年 2 月 5 日
I would like to subtract one data from the other to get an insertion loss. By insertion loss I mean that I am running (2) test cases, one control system and one with equipment in the line. I want to get the difference in signal amplitude between the two tests. Hence by inserting the equipment into the system, what is the loss of signal amplitude. Having the difference (and later the quotient) will let me conclude how the equipment affects the system at each source pulsation frequency. 
Is there a way to ensure I’m subtracting the correct amplitudes by linking them to the frequencies? 
Even if the vectors were the same length, there is some variability in the frequency data since it was taken manually from the tachometer. I can’t be sure that sample 2000 is the same frequency on one run as sample 2000 on the next run, or even that I get a value for that frequency. 

採用された回答

MathWorks Support Team
MathWorks Support Team 2023 年 12 月 2 日
編集済み: MathWorks Support Team 2024 年 2 月 5 日
You may consider using the timeseries object in this case.
Run the below command in your MATLAB instance to access the release specific documentation on 'timeseries' object:
web(fullfile(docroot, 'matlab/ref/timeseries.html'))
For example.
% Associate the frequency with amplitude
>> ts1 = timeseries(mag',freq');
% Associate another frequency with amplitude
>> ts2 = timeseries(mag',freq'-0.02);
% Synchronize the frequency
>> [ts3, ts4] = synchronize(ts1,ts2,'Union');
% Plot the difference
>> plot(ts3.Time, ts3.Data-ts4.Data)
For more options on synchronizing the two vectors (interpolation method, tolerance, etc), refer to the following example.
Run the below command in your MATLAB instance to access the release specific documentation on the same:
web(fullfile(docroot, 'matlab/ref/timeseries.synchronize.html'))
Please follow the below link to search for the required information regarding the current release:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Signal Processing Toolbox についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by