2D color map change the input of y axis

2 ビュー (過去 30 日間)
Chalisa Mawla
Chalisa Mawla 2022 年 5 月 2 日
コメント済み: Chalisa Mawla 2022 年 5 月 3 日
I have this script that will compile the data in each file into a 2D color map.
I wanted to change the value of the y axis so that I have the wave number (k) in y axis, instead of wavelength. k=2pi/wavelength
How I might be able to do this?
,filenames={'000.mat','013.mat','025.mat','038.mat','050.mat','063.mat','075.mat','088.mat','100.mat','113.mat','125.mat','138.mat','150.mat','163.mat','175.mat','188.mat','213.mat','225.mat','238.mat','250.mat','263.mat','275.mat','288.mat','300.mat','313.mat','325.mat','338.mat','350.mat','363.mat','375.mat','388.mat','400.mat','413.mat','425.mat','438.mat','450.mat','463.mat','475.mat','488.mat','500.mat'}
for i=1:numel(filenames)
load(filenames{i});
%print(filenames{i});
t_data(:,i) = lum.y0
end
angle = linspace(0,0.5,51);
wav_leng = lum.x0.';
figure;
imagesc(angle,wav_leng,t_data); colormap turbo; axis xy;
xlabel('kx')
ylabel('Wavelegnth (nm)')

採用された回答

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2022 年 5 月 3 日
Hello
There are 2 ways to change the values of the y axis, first is to change the values when you plot. I do not have your files so I will use random numbers instead:
imagesc([0:0.01:0.2],[400:900],rand(numel(0:0.01:0.2),numel(400:900)))
axis xy
This simulates your figure, now instead of using [400:900], which is your wav_leng, change it like this:
imagesc([0:0.01:0.2],2*pi./[400:900],rand(numel(0:0.01:0.2),numel(400:900)))
axis xy
The second would be to change the tick values once you plot. Let me know if this works or if you need the second option.
  1 件のコメント
Chalisa Mawla
Chalisa Mawla 2022 年 5 月 3 日
Let me try this!

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by