Effacer les filtres
Effacer les filtres

Highlight Specific Portion of Graph

5 vues (au cours des 30 derniers jours)
Brittany Burns
Brittany Burns le 19 Sep 2020
Commenté : Star Strider le 19 Sep 2020
I am trying to highlight the visible wavelength that would appear on the curve (0.4-0.7) in figure 2. How do I do this? I.e. I want to highlight the portion of the curve that falls under the wavelength from 0.4-0.7.
clear all; clc
%Since we are working with a blackbody, we assume n=1, which
%then allows us to use Stefan-Boltzmann's constant and law
n=1;
T=1300; %[Kelvin]
sigma = 5.67e-8; %Stefan-Boltzmann constant [W/(m^2*K^4)]
C1=0.59585522e8; %[W*micrometers^4/m^2*Sr]
C2=14357.770; %[micrometer*K]
%Spectral Intensity
lambda=10e-2:0.1:10e2; %[micrometers]
I=(2*C1)./(n^2.*lambda.^5.*(exp(C2./(n.*lambda.*T))-1));
clf;figure(1)
semilogx(lambda,I)
%Emissive Power
wl=10e-2:0.05:10e2;%[micrometers]
E=(2*C1*pi)./(n^2.*wl.^5.*(exp(C2./(n.*wl.*T))-1));
figure(2)
semilogx(wl,E)
hold on

Réponse acceptée

Star Strider
Star Strider le 19 Sep 2020
I am not ccertain what you want to highlight, since that region is vanishingly small.
Try this:
%Emissive Power
wl=10e-2:0.05:10e2;%[micrometers]
E=(2*C1*pi)./(n^2.*wl.^5.*(exp(C2./(n.*wl.*T))-1));
Lv = (wl >= 0.4) & (wl <= 0.7);
figure(2)
plot(wl,E)
hold on
patch([wl(Lv) fliplr(wl(Lv))], [zeros(size(E(Lv))) fliplr(E(Lv))], 'r')
hold off
set(gca, 'XScale','log')
ylim([0 200])
figure(3)
plot(wl,E)
hold on
patch([wl(Lv) fliplr(wl(Lv))], [zeros(size(E(Lv))) ones(1,nnz(Lv))*max(ylim)], 'r', 'FaceAlpha',0.25)
hold off
set(gca, 'XScale','log')
ylim([0 200])
The first plot colourss the area under the curve, and the second plot highlights the entire region to the limits of the y-axis.
I restricted the y-axis limit in order to see the area of interest. With the normal limits, it iis simply not visible.
  2 commentaires
Brittany Burns
Brittany Burns le 19 Sep 2020
Thanks!
Star Strider
Star Strider le 19 Sep 2020
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by