how to flip and combine two spectra for comparison

2 ビュー (過去 30 日間)
aneps
aneps 2017 年 8 月 7 日
コメント済み: aneps 2017 年 8 月 16 日
I want to compare two spectra. What I do is multiply the Y axis of one of the spectra with -1 and then plot both the spectra on the same figure. It is good to compare but look bad while I present. Because the intensity axis of one spectra appear negative values. Is there any other way to code so that I can get spectra look like the one in the attached image?
This example I downloaded from internet. Here Y axis of both the spectra shows the real intensity.

採用された回答

Walter Roberson
Walter Roberson 2017 年 8 月 7 日
You could normalize each spectrum perhaps.
plot(time, spectrum1 ./ max(spectrum1), time, -spectrum2 ./ max(spectrum2))
  5 件のコメント
Walter Roberson
Walter Roberson 2017 年 8 月 12 日
Oh, this is all about the labeling of the second plot?
In that case, use plotyy(), or the more modern yyaxis(), and set the bottom one to have 'YDir', 'reverse'. For example,
ax1 = subplot(2,1,1); plot(x,y1)
ax2 = subplot(2,1,2); plot(x,y2)
linkaxes([ax1,ax2],'x')
set(ax2,'YDir','reverse')
pos1 = get(ax1,'Position');
set(ax2,'Position', [pos1(1) pos1(2)-pos1(4), pos1(3), pos1(4)])
set(ax1,'XTick',[])
aneps
aneps 2017 年 8 月 16 日
Thank you very much.... This is exactly what I want!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by