File Exchange

image thumbnail

Blackbody Radiation Spectrum from Wien's Law and Planck's law

version (1.49 KB) by Sathyanarayan Rao
This code calculates blackbody radiation spectrum at different temperatures


Updated 25 Oct 2014

View License

Wien's law and Plancks law for black-body radiation is compared and plotted.

Cite As

Sathyanarayan Rao (2021). Blackbody Radiation Spectrum from Wien's Law and Planck's law (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Salman Ahmed



Just wanted to re-affirm that this script did exactly what I expected and Stephan Suckow's suggestions worked as well.
A couple minor suggestions:
1.) Before entering the for loop, initialize the size of I1 and I2 using the following:
I1 = zeros(length(Lam),length(T));
I2 = zeros(length(Lam),length(T));
2.) Change for loop to iteration variable and range to:
for ii = 1:length(T)
The first suggestion may help speed things up. The second one does two things 1) change the for loop iteration variable from i to ii (MATLAB uses i for imaginary numbers) and 2) allows one to change the length of T and not have to modify the for loop range.

Thank you.

fahhad al atshan

Stephan Suckow

Does exatly what it claims. Minor improvement suggestion:

Line 33: plot(Lam,I1(:,i),'b','linewidth',2)
Line 42: line([1.2e-5 1.4e-5], [5e8 5e8],'color','b','linewidth',2)

This way the legend matches the line color for all temperatures in newer Matlab versions.

Simo Tukiainen

Francisco Mendoza

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!