Hello,
After calculation gammadot that need locate in table_gammadot (I tried "ismember" is no help), so to get table_eta that function table_gammadot.
Do not use interp1!
Thanks for the helpers
function [eta]=Viscosityy(y)
L0=128;
gammadot= y/(y-L0);
table_gammadot=[0.02 0.05 0.09 0.18 0.3 0.5 0.9 1.8 3 5 9 18 30];
%locate in table_gammadot that equal value to gammadot
%table_gammadot=result
%table_eta is function table_gammadot
%for example table_gammadot=0.05 => table_eta=28.73309
table_eta=[62.20241 28.73309 16.96822 9.024566 5.742004 3.634656 2.099485 1.107372 0.703221 0.429745 0.251424 0.134518 0.082058];
%eta=table_eta
end
end

댓글 수: 4

Hello,
Are you looking to return the table_eta value for a given table_gammadot without interpolation of table_eta values in between?
findVal = 0.18
eta = table_eta(findVal == table_gammadot)
Emilia
Emilia 2021년 1월 3일
That's not what I meant. Yes without interpolation.
For example gammadot=0.03, from table_gammadot we get 0.05 => table_eta= 28.73309
eta=table_eta
Mario Malic
Mario Malic 2021년 1월 3일
For gammadot=0.03, why shouldn't the table_gammadot be 0.02, since it's the closest one. Are you taking the next higher value?
Emilia
Emilia 2021년 1월 3일
Sorry I was wrong. Yes you are right the table_gammadot be 0.02.

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

 채택된 답변

Mario Malic
Mario Malic 2021년 1월 3일

0 개 추천

This will do it
findVal = 0.03;
[~, valIndex] = min(abs(table_gammadot - findVal));
eta = table_eta(valIndex)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2021년 1월 3일

댓글:

2021년 1월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by