How can I plot BB spectrum with logarithmic x axis and y axis
Show older comments
Hello everyone! I am relative new in matlab and I am trying to plot a black body spectrum using Planck's equation but I want both x axis and y to be in logarithmic scale. But every time that I try to plot them both in logarithmic scale the graph's shape is distorted..I checked my units because I want to convert the meters to μm but still no luck..I post below the code. Thank you in advance everyone, I hope someone will help me!
c=3*10^14; % speed of light in vaccum [μm/sec]
h=6.625*10.^-34*10^12; % Planck constant(m^2kg/s)*10^12 --> [microns]
k=1.38*10.^-23*10^12; % Boltzmann constant [m^2 kg s^-2 K^-1]*10^12 -->[microns]
T=50; % Temperatures in Kelvin
b = 1.5;
Lam=(0.7:0.1:10000);
I1 = ((2*h*c)./(Lam.^3)).* (1./(exp((h*c)./(Lam*T*k))-1));
plot(Lam,I1);
set(gca, 'XScale', 'log');
%%set(gca, 'YScale', 'log');
figure
loglog(Lam,I1);
Accepted Answer
More Answers (0)
Categories
Find more on Log Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!