Trying to fill the area under the function up to the dotted line.... can't figure out how to get area or fill functions to work

조회 수: 2 (최근 30일)
clear;clc;
syms lam
c1=3.7142*10^-16; %W*m^2 c2=1.4388*10^-2; %m*K eps=0.7; T=2000; %K c=299792458; %m/s h=6.62607004*10^-34; %m^2*kg/s E1=1.1*1.602*10^-19; %J or kg*m^2/s^2
lam1=h*c/E1;
M=eps*c1/(lam.^5*(exp(c2/(lam*T))-1)); fplot(M,[0,10*10^-6]) line([lam1 lam1],[0 M1],'Color','red','LineStyle','--')
x=linspace(0,lam1); M1=eps*c1/(lam1^5*(exp(c2/(lam1*T))-1)); area(x,M1)

채택된 답변

Stephan
Stephan 2018년 5월 26일
Hi,
i suppose you wanted to achieve this:
to do so i changed your code this way:
clear;
clc;
syms lam
c1=3.7142*10^-16; %W*m^2
c2=1.4388*10^-2; %m*K
eps=0.7;
T=2000; %K
c=299792458; %m/s
h=6.62607004*10^-34; %m^2*kg/s
E1=1.1*1.602*10^-19; %J or kg*m^2/s^2
lam1=h*c/E1;
x=linspace(0,lam1);
M=eps*c1/(lam.^5*(exp(c2/(lam*T))-1));
M1=eps*c1./(x.^5.*(exp(c2./(x*T))-1));
hold on
fplot(M,[0,10*10^-6])
line(x, M1,'Color','red','LineStyle','--')
area(x,M1)
hold off
Best regards
Stephan

추가 답변 (0개)

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by