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

So you want to solve for theta from the equation
theta=u-w+(theta+8)*gamma*23-8/(theta+1)
?
Best wishes
Torsten.
Heartrin
Heartrin 2015년 10월 29일
yes i need to calculate theta.
how do i write it in loop?
Torsten
Torsten 2015년 10월 29일
Why in a loop ? Do you want to calculate it iteratively ?
Best wishes
Torsten.
Heartrin
Heartrin 2015년 10월 29일
yes, all the variables in the formula is an array. i have to do it iteratively only right? or can i do it without a loop?

댓글을 달려면 로그인하십시오.

 채택된 답변

Torsten
Torsten 2015년 10월 29일

0 개 추천

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

Heartrin
Heartrin 2015년 10월 29일
thanks.
what if the equation is,
theta_dot = u+h1-h2-w
h1 = (theta+8)*gamma*23; h2 = 8/(theta+1)
theta_dot i mean its a dtheta/dt. then i have to use loop right?
Torsten
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개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2015년 10월 29일

댓글:

2015년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by