Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab计算给定波长范围内10层的线参数x_Matlab - Fatal编程技术网

Matlab计算给定波长范围内10层的线参数x

Matlab计算给定波长范围内10层的线参数x,matlab,Matlab,考虑到给定的波长范围为50到550μm,我知道如何计算下面定义为x的线参数。现在我想对所有10层重复这个计算。当温度从第1层到第10层变化时,所有其他参数保持不变。如有任何建议,将不胜感激 wl=[100 200 300 400 500]; %5 wavelengths, 5 spectral lines br=[0.12 0.56 0.45 0.67 0.89]; % broadening parameter for each wavelength T=[101 102 103 104 10

考虑到给定的波长范围为50到550μm,我知道如何计算下面定义为x的线参数。现在我想对所有10层重复这个计算。当温度从第1层到第10层变化时,所有其他参数保持不变。如有任何建议,将不胜感激

wl=[100 200 300 400 500]; %5 wavelengths, 5 spectral lines 
br=[0.12 0.56 0.45 0.67 0.89]; % broadening parameter for each wavelength
T=[101 102 103 104 105 106 107 108 109 110];% temperature for 10 layers
wlall=linspace(50,550,40);%all the wavelength in 50um to 550 um range

% x is defined as,
%(br*wl/(br*br + (wlall-wl)^2))*br;
%If I do a calculation for the first line 
((br(1)*T(1)*wl(1))./(br(1)*br(1)*(T(1)) + (wlall(:)-wl(1)).^2))*br(1)*T(1)


%Now I'm going to calculate it for all the lines in the first layer
k= repmat(wlall,5,1);


for i=1:5;
       kn(i,:)=(br(i)*T(1)* wl(i)./(br(i)*br(i)*T(1) + (k(i,:)- 
       wl(i)).^2))*br(i)*T(1);

end


%Above code gives me x parameter for all the wavelengths in the
%given range( 50 to 550 um) in the first layer, dimension is (5,40)

% I need only the maximum value of each column

an=(kn(:,:)');
[ll,mm]=sort(an,2,'descend');
vn=(ll(:,1))'
%现在我的输出有维度,(1,40)一是第一层,40是 %对应于第一层中每个波长的最大x参数 %现在我想计算所有10层中的x参数,所以T应该不同 %从T(1)到T(10),得到
%每列中的最大值,因此我的输出应该有维度(10,40)

您只需要为每个“T”值运行一个额外的“for”循环。以下是一个例子:

            clc; close all; clear all; 

            wl=[100 200 300 400 500]; %5 wavelengths, 5 spectral lines 
            br=[0.12 0.56 0.45 0.67 0.89]; % broadening parameter for each wavelength
            T=[101 102 103 104 105 106 107 108 109 110];% temperature for 10 layers
            wlall=linspace(50,550,40);%all the wavelength in 50um to 550 um range

            % x is defined as,
            %(br*wl/(br*br + (wlall-wl)^2))*br;
            %If I do a calculation for the first line 
            ((br(1)*T(1)*wl(1))./(br(1)*br(1)*(T(1)) + (wlall(:)-wl(1)).^2))*br(1)*T(1)


            %Now I'm going to calculate it for all the lines in the first layer
            k= repmat(wlall,5,1);

            for index = 1:numel(T)


                for i=1:5

                       kn(i,:, index)=(br(i)*T(index)* wl(i)./(br(i)*br(i)*T(index) + (k(i,:)- wl(i)).^2))*br(i)*T(index);

                end

                an(:, :, index) = transpose(kn(:, :, index));

                vn(:, index) = max(an(:, :, index), [], 2);

            end

            vn = transpose(vn);

非常感谢你,纳什。我很感谢你。