b, z numbers come out but from there onwards e, w, j, k, t and the others leave NaN why?
b=(str2double(get(handles.edit12,'string'))-str2double(get(handles.edit10,'string')))/(str2double(get(handles.edit11,'string'))-str2double(get(handles.edit8,'string')))
z=(str2double(get(handles.edit14,'string'))-str2double(get(handles.edit12,'string')))/(str2double(get(handles.edit13,'string'))-str2double(get(handles.edit11,'string')))
e=(str2double(get(handles.edit16,'string'))-str2double(get(handles.edit14,'string')))/(str2double(get(handles.edit15,'string'))-str2double(get(handles.edit13,'string')))
w=(str2double(get(handles.edit18,'string'))-str2double(get(handles.edit16,'string')))/(str2double(get(handles.edit17,'string'))-str2double(get(handles.edit15,'string')))
j=(str2double(get(handles.edit20,'string'))-str2double(get(handles.edit18,'string')))/(str2double(get(handles.edit19,'string'))-str2double(get(handles.edit17,'string')))
k=(z-b)/(str2double(get(handles.edit13,'string'))-str2double(get(handles.edit18,'string')))
t=(e-z)/(str2double(get(handles.edit15,'string'))-str2double(get(handles.edit11,'string')))
l=(w-e)/(str2double(get(handles.edit17,'string'))-str2double(get(handles.edit13,'string')))
n=(j-w)/(str2double(get(handles.edit19,'string'))-str2double(get(handles.edit15,'string')))
b0=str2double(get(handles.edit10,'string'))
y=b0+b*(x-str2double(get(handles.edit8,'string')))+k*(x-str2double(get(handles.edit8,'string')))*(x-str2double(get(handles.edit11,'string')))

댓글 수: 4

Erwin Avendaño
Erwin Avendaño 2017년 11월 5일
The method is interpolation of newton
Image Analyst
Image Analyst 2017년 11월 5일
Post a screenshot of your GUI so we can see what numbers you've typed into the edit fields.
Erwin Avendaño
Erwin Avendaño 2017년 11월 5일
wait a moment please a curious fact is that I did the operations with my calculator and I do not leave a division of 0/0 I get a number
Erwin Avendaño
Erwin Avendaño 2017년 11월 5일

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 11월 5일

0 개 추천

I recommend doing each str2double only once and assign each to a meaningful variable name and then do the calculations. You can examine the variables to see if you got any nan, which is possible if the corresponding string did not represent a scalar double. You can also get nan from 0/0

댓글 수: 4

Erwin Avendaño
Erwin Avendaño 2017년 11월 5일
What do you mean by a significant variable name? I did the calculations with a manual calculator and it does not give me a 0/0 gives me a number is what I do not understand is curious because the first two if they give me a number as I mentioned before but from then on e, w, j give me NaN
Erwin Avendaño
Erwin Avendaño 2017년 11월 5일
Walter Roberson
Walter Roberson 2017년 11월 5일
What you posted does not tell us what is stored in the strings. Show us the result of get() of each of the handles used in the formula
Erwin Avendaño
Erwin Avendaño 2017년 11월 5일
It is solving a problem with my program that I check several times that it was fine so I tried another problem and this one if I solved it well and if no mistake no longer told me NaN thank you

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2017년 11월 5일

댓글:

2017년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by