Undefined function or variable Error and not printing the value of needed variable
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Finn Meissner
2015년 9월 1일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!