I’ve seen this example on MATLAB but I’m not sure how to make this function to plot.
function[data] = ShockleyQueisser(varargin)
%%%%%%%%%% defaults
sun = 'am1.5';
lossType = 'none';
lossVal = 1;
sweepVar = 'Eg';
sweepVal = linspace(0.4,2,100);
conc = 1;
emAngConc = 1;
qyFunc = @(E,Eg) 1;
TSun = 5780; % only used if 'sun'=='blackbody'
numE = 1000; % only used if 'sun'=='blackbody'
%%%%%%%%%%
%%%%%%%%%% Fundamental Constants
q = 1.602176565e-19;
h = 6.62606957e-34;
kT = 0.026; % technically kT/q, approx T=302K
kB = 1.3806488e-23;
c = 29979245800; % cm/s
%%%%%%%%%%
procArgs(varargin);
% photonFlux has units mA/cm^2/eV (i.e. current density per unit energy)
if(strcmp(sun,'am1.5'))
data = load('spectrum.mat'); % in ./Data
photonFlux = data.photonFlux;
E = data.E;
clear data;
else
E = linspace(0.1, 5, numE);
omegaSun = 6.85e-5; % SQ
photonFlux = omegaSun * 2*1e3*(q^4/h^3/c^2)*E.^2.*exp(-E/(kB*TSun/q)); % extra factor of 1e3*q to get mA
end
% totCurrent = trapz(E, photonFlux) % 69 mA/cm^2, un-comment to verify
totPower = trapz(E, conc * E .* photonFlux); % 100.037 mW/cm^2 if 'am1.5'
fprintf('Total power in solar spectrum: %g mW/cm^2 \n', totPower);

1 Kommentar

YaLin
YaLin am 11 Apr. 2023
I'm running this code, can I ask you some questions? I can't understand the formula inside

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Guru Mohanty
Guru Mohanty am 13 Mai 2020

0 Stimmen

Hi, I understand you are trying to plot Shockley Queisser. You can plot by these following steps.
clc;clear all;
Eg = linspace(0.4,2,100);
qy = @(E,Eg) floor(E/Eg);
d = ShockleyQueisser('Eg',Eg,'etaInt',0.9,'cm',qy);
figure;
plot(Eg, d.eff);
For more examples, you can refer here.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by