フィルターのクリア

Using Values from Tabulated Data

1 回表示 (過去 30 日間)
Lilly
Lilly 2023 年 10 月 11 日
編集済み: Matt J 2023 年 10 月 12 日
Hello,
Let's say there is a function called A(t). A(t) is not a defined function, but there are specific values of A for given values of t.
Ex:
if t=1, A=78
t=2.5, A=80
etc.
For reference, there are about 20 values of t that are given with 20 values of A
How can I code this in matlab so that, in I enter A(1) it returns a value fof 78?
Thanks!

採用された回答

Matt J
Matt J 2023 年 10 月 12 日
編集済み: Matt J 2023 年 10 月 12 日
t = [1 2.5 3.6 4];
A = [78 80 85 96];
Afun=@(tq)interp1(t,A,tq);
Afun(1)
ans = 78
Afun(2)
ans = 79.3333
Afun(2.5)
ans = 80

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by