How do I create a script to calculate the intensity vs a specific wavelength?

조회 수: 2 (최근 30일)
Schyler Turner
Schyler Turner 2021년 4월 6일
편집: DGM 2021년 4월 6일
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

답변 (1개)

DGM
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:

카테고리

Help CenterFile 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!

Translated by