Variable names in fsolve

조회 수: 4 (최근 30일)
Kyriacos
Kyriacos 2011년 11월 25일
Hello everyone, I am wondering whether I could use variable names in using solve, instead of x(1), x(2).... For example, imagine that x(1) is variable "output", which I name Y, x(2) is consumption which I name C and x(3) investment (I). So, in fsolve I should write:
x(1) - x(2) - x(3) ;
But is there a way I could write:
Y - C - I ;
and matlab understands what I mean?
Thanks!!
Kyriacos

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 11월 25일
Just replace the variables:
function F = myfun(x)
Y = x(1);
C = x(2);
I = x(3);
.
.
.

추가 답변 (1개)

Kyriacos
Kyriacos 2011년 11월 25일
Thanks!! I thought about it, was not sure it would work...

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by