Undefined function or variable Error and not printing the value of needed variable
1 view (last 30 days)
Show older comments
when i am trying to run the following code
clc clear all close all format long input('Sellemeier Coefficient [a1]='); input('Sellemeier Coefficient [a2]='); input('Sellemeier Coefficient [a3]=');
input('Sellemeier Coefficient [b1]='); input('Sellemeier Coefficient [b2]='); input('Sellemeier Coefficient [b3]='); input('Light Wavelenth [lambda]=')
RI = sqrt(1+((b1*(lambda^2))/((lambda^2)-a1))+((b2*(lambda^2))/((lambda^2)-a2))+((b3*(lambda^2))/((lambda^2)-a3)));
disp(RI)
then it is not printing the value of RI instead of printing the value of RI it is printing the value of lambda only. so please suggest me the right answer.With this mail i am attaching JPEG file of my code. u can see the same code with error in that image also
I am getting the following error
Undefined function or variable 'b1'.
Error in reff_ind_mea (line 14) RI = sqrt(1+((b1*(lambda^2))/((lambda^2)-a1))+((b2*(lambda^2))/((lambda^2)-a2))+((b3*(lambda^2))/((lambda^2)-a3)));
0 Comments
Answers (1)
Finn Meissner
on 1 Sep 2015
Little heads up before we go to deep into the topic: input('Choose a=') doesnt set the variable 'a', but rather ask for an input while showing the string 'Choose a=' to define the parameter try
a1=input('Sellemeier Coefficient [a1]=');
a2,a3 and b1-3 respectively. That might fix your problem right away
See Also
Categories
Find more on Numeric Types 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!