Beginner question: Loops in Matlab
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all,
I need to write matlab codes for the below formula.
theta = u+h1-h2-w
in this formula,
h1 = (theta+8)*gamma*23; h2 = 8/(theta+1)
so its a loop which i have to write. All u,w,h1,h2,gamma is an array
how and what loop should i use to write a code for this problem?
4 件のコメント
Torsten
2015 年 10 月 29 日
Why in a loop ? Do you want to calculate it iteratively ?
Best wishes
Torsten.
採用された回答
Torsten
2015 年 10 月 29 日
Two solutions:
theta1=(1-(u-w)-9*23*gamma)./(2*(23*gamma-1))+sqrt(((1-(u-w)-9*23*gamma)./(2*(23*gamma-1))).^2-(-(u-w)-8*23*gamma+8)./(1-23*gamma))
theta2=(1-(u-w)-9*23*gamma)./(2*(23*gamma-1))-sqrt(((1-(u-w)-9*23*gamma)./(2*(23*gamma-1))).^2-(-(u-w)-8*23*gamma+8)./(1-23*gamma))
Best wishes
Torsten.
2 件のコメント
Torsten
2015 年 10 月 29 日
I don't understand what you will try to do within a loop.
Use MATLAB's ode45 to solve your differential equations.
Best wishes
Torsten.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!