To find value of variable using iteration
古いコメントを表示
Hello,
At first I need to generate a random number that was done using rand command.
Then I have to use iteration such that it satisfies a certain relation. I used while loop but it is not stopping.
x = rand(1,1);
while 350-12.9-x-32.4498 ~= 0
x= x+ 0.0001
end
The problem is other values can also change drastically so it would take a long time to find values. Any other suggestions?
採用された回答
その他の回答 (1 件)
Awais Saeed
2021 年 8 月 28 日
編集済み: Awais Saeed
2021 年 8 月 28 日
What is your goal exactly? Do you want to find the value for x where the result is zero? You can find the roots using solve
syms x
vpa(solve(350-12.9-x-32.4498 == 0,x))
カテゴリ
ヘルプ センター および File Exchange で Error Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!