Borrar filtros
Borrar filtros

Highlight Specific Portion of Graph

14 visualizaciones (últimos 30 días)
Brittany Burns
Brittany Burns el 19 de Sept. de 2020
Comentada: Star Strider el 19 de Sept. de 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

Respuesta aceptada

Star Strider
Star Strider el 19 de Sept. de 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 comentarios
Brittany Burns
Brittany Burns el 19 de Sept. de 2020
Thanks!
Star Strider
Star Strider el 19 de Sept. de 2020
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by