Please someone solve me error of matrix dimension for focal lengths equation

1 view (last 30 days)
clear all;
close all;
clc;
n1=1.49;
n2=1:.1:2.42;
r1=.25;
r2=.50;
f=(((n1/n2)-1)*((1/r1)-(1/r2)))^-1;
fl=1/f;
plot(n2,fl);
xlabel('Refractive indices of surrounding material');
ylabel('Focal length');
title('Different focal lenths for varying refractive indices of different
materials')

Answers (1)

Walter Roberson
Walter Roberson on 23 Oct 2017
f = (((n1./n2)-1)*((1/r1)-(1/r2))).^-1;
fl = 1./f;
Though since the .^-1 is the same as 1/ I do not know why you do not just directly calculate
fl = (((n1./n2)-1)*((1/r1)-(1/r2)));

Categories

Find more on Particle & Nuclear Physics 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!