How do I create a script to calculate the intensity vs a specific wavelength?
3 次查看(过去 30 天)
显示 更早的评论
I need to use the equation for the planck function, =(c1*wavelength^-5/e^c2/wavelength*T-1)(1/3.14)
So far for my script I have :
%% Import data from text file
% Script for importing data from the following text file:
%
% filename: C:\Users\smctu\OneDrive\Documents\School\Remote Sensing\Matlab_hw_5.txt
%
% Auto-generated by MATLAB on 05-Apr-2021 22:19:14
%% Setup the Import Options and import the data
opts = delimitedTextImportOptions("NumVariables", 2);
% Specify range and delimiter
opts.DataLines = [2, Inf];
opts.Delimiter = " ";
% Specify column names and types
opts.VariableNames = ["wavelength", "Temperature"];
opts.VariableTypes = ["double", "double"];
% Specify file level properties
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
opts.ConsecutiveDelimitersRule = "join";
opts.LeadingDelimitersRule = "ignore";
% Import the data
Matlabhw5 = readtable("C:\Users\smctu\OneDrive\Documents\School\Remote Sensing\Matlab_hw_5.txt", opts);
figure
X1=Matlabhw5.Temperature
Y2=Matlabhw5.wavelength
X2=
plot(X2,Y2,"Color","r")
%% Clear temporary variables
clear opts
0 个评论
回答(1 个)
DGM
2021-4-6
编辑:DGM
2021-4-6
If you're just asking how to write the expression:
% i'm assuming these are the inputs
T=Matlabhw5.Temperature
lambda=Matlabhw5.wavelength
% c1 and c2 are constants
% make sure they correspond to your units/goals
% use c1L if you want spectral radiance
% use c1 if you want spectral radiant exitance
c1L=1.191042869E-16; % W*m^2/sr
c1=3.74177753E-16; % W*m^2
c2=1.438770E-2; % m*K
% and this is the output
X2=(c1*lambda^-5) / (exp(c2/(lambda*T))-1)
% idk what the (1/pi) is for, but use it if you need to
I didn't test this or anything
Constants are from pg65:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!