I need to find the the value of one variable against the other How can I do that ?

1 回表示 (過去 30 日間)
My a variable can take the value A=9075.5 if B=1 and A=5464.8 if B=0. In my function I need to to find the values of A corresponding to the other values of B for example if my function for certain simulations chooses B=0.7 then my function should interpolate and find the corresponding value of A. How can I do that?

採用された回答

the cyclist
the cyclist 2021 年 11 月 27 日
編集済み: the cyclist 2021 年 11 月 27 日
You can use the interp1 function:
% Input data
A = [5464.8 9075.5];
B = [0 1];
% Some new value of B:
B_new = 0.7;
% Interpolate
A_new = interp1(B,A,B_new)
A_new = 7.9923e+03
See the documentation I linked for more details on how to use this function.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by