Code covered by the BSD License  

Highlights from
tv_dimensions

from tv_dimensions by Vince Petaccio
Gives dimensions of a television or rectangle, given the diagonal size and aspect ratio.

tv_dimensions(diag,arat)
function [w h] = tv_dimensions(diag,arat)
% This function accepts the diagonal size (the size usually advertised) in 
% inches of a television's screen, as well as the aspect ratio of that 
% television, as inputs, and returns the width and height of the 
% television screen in inches. Technically, this function will give the
% width and height of any rectangle where only the diagonal size and aspect 
% ratio are known.
% 
% Input argument defintion
% diag = integer value for diagonal TV size in inches
% arat = 2-element vector in the form [width height]
% 
% Common aspect ratios are 4x3 (fullscreen) and 16x9 (widescreen) for 
% televisions, and 16x10 for widescreen computer monitors. 
%
% Example:
% A 26" widescreen television:
% [w h] = tv_dimensions(26,[16 9])
% w = '22.661 inches'
% h = '12.7468 inches'
% 
% Enjoy! :o]
% 
% Written by Vince Petaccio on January 23, 2009

arw = arat(1);
arh = arat(2);
ardiag = sqrt((arw^2)+(arh^2));
sizefactor = diag/ardiag;
wdouble = sizefactor*arw;
hdouble = sizefactor*arh;

%Convert the values to strings, and concatenate the "inches" note
w = [num2str(wdouble) ' inches'];
h = [num2str(hdouble) ' inches'];

Contact us at files@mathworks.com