Using First Two Columns to Solve for Third

1 回表示 (過去 30 日間)
Alex Dargahi
Alex Dargahi 2022 年 4 月 19 日
回答済み: KSSV 2022 年 4 月 19 日
Hello, I've been having trouble with assigning data from my array to a function.
I have one array that goes M = [0;30;90;180;200;350]
I have another that goes e = [0.01;0.01;0.01;0.01;0.01]
I need my function use the first/only value from each column to solve. So it would take 0 and 0.01, 30 and 0.01, 90 and 0.01 and so on, then input it into my function to give me what would be 6 values.
I can't seem to find out how to get those values in my function then have it print a third column with the corresponding answers. Does anyone have any input? Sorry if this is a bleak question, this is my first post. Please let me know if you need any more information.

回答 (1 件)

KSSV
KSSV 2022 年 4 月 19 日
M = [0;30;90;180;200;350] ;
e = [0.01;0.01;0.01;0.01;0.01;0.01] ;
N = length(M) ;
iwant = cell(N,1) ;
for i = 1:N
iwant{i} = myfunction(M(i),e(i)) ;
end

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by