Looping a function in MATHLAB

Please, how can I loop this function
function y = f(x)
y = sqrt(1 - (x^2)*(Z^2));
end
to solve for different values if Z (ie Z(i))
Thank you

回答 (1 件)

David Hill
David Hill 2020 年 4 月 4 日

0 投票

No loop needed, just provide Z array to function. Output, y will contain the array of corresponding outputs for the different Z's given the x-value.
function y = f(x,Z)
y = sqrt(1 - (x^2)*(Z.^2));
end

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2020 年 4 月 4 日

回答済み:

2020 年 4 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by